data class A (val x: Array<String>? = null) {
val y = x?.filter { it!="something" }
}
This code should make member y
to be calculated when an A
object is created.
When I initiate an A
object, both x
and y
gets a value.
However, when I define object A
as a response in a GET
request using retrofit2
, x
gets a value but y
is null
.
I cannot figure out the reason, (maybe relative to threads? I am using retrofit with coroutines), but can not explain it.
Any ideas?