One algorithm question. If I have a following nested object lists, and I want to remove
"3" from every `object2`:
object1: TestType = [
object2=[
(...)
random = ...,
stringList = ["1", "2", "3"]
],
object2(),
object2(),
(....)
]
Something like this should work, but I'm wondering is there a more elegant solution? I'm sure there is 😄 I guess I could do a
object2Mapper
which could filter "3" as well.
fun TestType.getWithout3(): TestType {
val returnObject = object1
returnObject.forEach { object1 ->
object1.object2.forEach { object2 ->
object2.stringList.toMutableList.removeAll { item == "3"}
}
}
return returnObject
}