James Whitehead
08/12/2021, 1:56 PMmutableSetOf()
and linkedSetOf()
.
Given that both methods return a LinkedHashSet
is there a recommendation on when to use one vs the other?diesieben07
08/12/2021, 2:09 PMmutableSetOf
does not guarantee that you get a LinkedHashSet
. All it guarantees is that you get a mutable set that preserves iteration order. linkedHashSet
will always return a LinkedHashSet
.
So personally I'd always go for mutableSetOf
unless you specifically need a LinkedHashSet
.