Does Kotlin support OptionSet?

Viewed 407

In Swift programming language an [OptionSet]1 is a modern interface on top of a bitset and it's used to define a set of options without dealing with low-level bitwise operation

The swift syntax is

let multipleOptions: ShippingOptions = [.nextDay, .secondDay, .priority]

Does Kotlin offers something similar? I know Kotlin has the BitSet2 but I'm looking for something more readable.

So far the best solution I have found is a Set<SomeEnum>.

0 Answers
Related