does anyone have an example of merging 2 Lists of ...
# getting-started
d
does anyone have an example of merging 2 Lists of Objects? I have Object A and Object B, I can match them on the same key but then I want to nest Object B under a deeper key in Object A
If merging them as JSON Objects is easier I should be able to do that
r
Not sure I understand, but maybe something like
Copy code
val aMap = aList.associateBy { it.prop }
for (b in bList) {
  aMap[b.prop]?.bList?.add(b)
}
d
cool thanks I’ll give this a try in the morning!