<@U0BRK9HC5> remember all the discussion about bit...
# random
e
@gildor remember all the discussion about bitwise operators and the suggested
EnumSet
which couldnt fit my needs? Well, nowadays after started playing with Swift, I can better define one of the disadvantage of
EnumSet
(at least for me): on jvm is a class, and it's passed by reference, deeper functions may modify the original content. While on Swift is instead a value type and then there is no problem passing it down to functions. Maybe it's possible to clone it, by this would introduce additional overhead in terms of verbosity and performances (I use flag intensively)
g
For sure, if you pass it somewhere you just do copy, it's a class with int field Also, of course it has disadvantage to be Java class, and as other Sets I Java is mutable, but if we would have Kotlin implementation we can have EnumSet and MutableEnumSet
n
What is the difference between Enum and EnumSet?
g
EnumSet is a specialized (optimized) Set for enums, can be used as type-safe replacement for bit flags
👍 1