Ok, so I have a list<SomeObject>
class SomeObject(
val number: Int,
val otherNumber: Int,
val list<OtherObject>
)
The objects in the list can have same number and otherNumber but different values in their list<OtherObject>
I want to merge every object in the list with the same number and otherNumber. So for example if I have a list<SomeObject> with 3 entries:
1 = SomeObject(1, 1, list<OtherObject>
2 = SomeObject(1, 1, list<OtherObject>
3 = SomeObject(1, 2, list<OtherObject>
I would want entry 1 and 2 to become one list entry with the values of both lists combined.
I can do this with a lot of looping and stuff, however the list is super long and I cannot seem to do it in an efficient manner.
Is there some kotlin function for this? Or do anyone have a good suggestion as to how I should approach it?