is Array<> in compose stable?
# compose
u
is Array<> in compose stable?
m
Immutability isn't enforced for arrays, so there are a whole array (no pun intended) of possible hard-to-find bugs that could spring up if someone writes code that mutates the array. Personally, I'd prefer
List<>
for this sort of thing.
u
so prefer ImmutableList ?
m
You could, but
List<>
is a read-only interface, so unless you're trying to cast it to other things, just
List<>
is probably what you want (it's what you get if you use
listOf<>(...)
for example.
thank you color 1
s
Importantly
List
actually unfortunately still is not considered stable for compose’s sake. So either just use ImmutableList for now, or wait for strong skipping mode to be turned on where they will also start inferring List as stable
🙌 1
m
That's good to know, thank you!
(I don't normally pass List<> directly, and the classes that I use that wrap it are annotated with @Immutable, so I forgot about that)
s
Then don’t worry about it
m
Yeah, but I need to not give out wrong information here 😅 so it still matters.