I am working on converting an enumset into a string of values that are in the enumset. At the moment, I am using Joiner.on(',').join(enumset))
to create a string of values. However, I am wondering what are the ordering guarantees that enumset provides?
Thanks!!
Yes, there are guarantees. See the Javadoc for EnumSet
.
The iterator returned by the iterator method traverses the elements in their natural order (the order in which the enum constants are declared). The returned iterator is weakly consistent: it will never throw ConcurrentModificationException and it may or may not show the effects of any modifications to the set that occur while the iteration is in progress.