One algorithm question. If I have a following nest...
# getting-started
a
One algorithm question. If I have a following nested object lists, and I want to remove "3" from every `object2`:
Copy code
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.
Copy code
fun TestType.getWithout3(): TestType {
	val returnObject = object1
	returnObject.forEach { object1 ->
		object1.object2.forEach { object2 ->
			object2.stringList.toMutableList.removeAll { item == "3"}
		}
	}
	return returnObject
}
Solved by using
mappers
and doing this logic while transforming objects. Not sure is there a better or more performant solution 🤷