Hmmm.... The keys are Comparable, so why wouldn't you treat the set as sorted?
I can only assume this had a bad performance impact, though that seems odd on the face of it... Ben Schulz wrote: > I would argue against having it implement SortedSet. Using a sorted > implies that you rely on a certain order of elements, but you can not > rely on the "natural" order of enum constants. If they were sorted by > name, we could talk, but... > > With kind regards > Ben > > On 30 Jul., 11:56, drd <[email protected]> wrote: > >> I was wondering: why is an EnumSet not a SortedSet. >> >> Javadoc of EnumSet says : ... the iterator returns the elements in >> their natural order ... >> >> Javadoc of SortedSet says: A Set that further provides a total >> ordering on its elements. The elements are ordered using their natural >> ordering, or by a Comparator typically provided at sorted set creation >> time... >> >> Why is then the EnumSet not a SortedSet? >> >> I hope somebody will be able to clarify my mind. >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
