It certainly wouldn't impact the existing methods. In my mind it would be like making HashSet a sorted set(if you exclude requirements for members to be Comparable). Is there a good reason to do it?
On Aug 6, 2:39 am, Reinier Zwitserloot <[email protected]> wrote: > I'm fairly sure you could stick SortedSet on both JumboEnumSet and the > normal one without impacting the performance of the existing methods. > The sorting may not be O(1), but even that should either (A) be easy > (for Jumbo), or (B) be irrelevant (scanning 64 bits is going to be O > (1) by virtue of that upper limit, no matter what you do). > > On Aug 6, 4:10 am, Stephen Gregory <[email protected]> wrote: > > > On Aug 5, 6:00 pm, Alexey <[email protected]> wrote: > > > > According to the docs, SortedSet expects to function based on either > > > natural order (if the elements implement Comparable) or in accordance > > > with whatever Comparator is provided. The only functional difference > > > between the SortedSet contract and EnumSet API are all the methods in > > > SortedSet dealing with subsets (first, subSet, etc.). Still doesn't > > > seem to be any good reason why EnumSet doesn't implement SortedSet. > > > EnumSet is a specialized set intended to allow enums to replace > > integer bitflags. Because of how this is implemented I don't think > > there is an efficient way to implement the SortSet interface. So the > > question is kind of should they have put in a poor-performing > > implementation and made note of it in the JavaDocs(Followed shortly > > thereafter with a FindBugs pattern saying not to use those methods.), > > or just leave well enough alone and let people just use the existing > > SortedSet implementations if they really need it? > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
