a
ummmmm
d
Looks like world is nullable and associateBy can't use nullables as keys, you could do it.world!! if you're sure it's not null, or just filter out thenones that are (or even better if possible, don't allow a null world in the first place...)
a
I am filtering them out though already?
.filter( it.world != null)
@dave08
a
@breandan but I am filtering if an element of the object is not null, not the object itself
b
you need to restructure the chain somehow, the compiler is not smart enough to infer what you want to do directly
Try something like
.mapNotNull { it.world?.let { w -> Pair(w, it) } ?: null }.toMap()
d
Sorry didn't see that, just do something like
mapNotNull { it.world?.let { RegionSettings(it, plugins) } }
instead of the map and filter... @Andrew Gazelka if you can turn
world
to not nullable that is... otherwise the previous answer is probably the best.