EnumSet as SequencedSet
M. Justin
mjustin.lists at gmail.com
Wed Jul 19 05:42:20 UTC 2023
Out of curiosity, is there a reason EnumSet doesn't implement SequencedSet
in the Java 21 Sequenced Collections feature? Other than not currently
having a reversed() implementation, it feels like it meets the requirements
for this interface. It would have to throw UnsupportedOperationException
for addFirst and addLast, but that's no different than what SortedSet does.
I suppose technically, there isn't any reason EnumSet couldn't have
implemented SortedSet (aside from implementation complexities with
supporting sublists in headSet()/subSet()/tailSet()), given that it already
is a set which is ordered based on its elements' natural ordering.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/java-se-spec-comments/attachments/20230719/b84f0416/attachment.htm>
More information about the java-se-spec-comments
mailing list