navigating enums

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

navigating enums

Kevin Bourrillion
Since all enums are Comparable, why is it that Enum{Set,Map} don't implement Sorted{Set,Map}, and aren't being retrofitted for Navigable{Set,Map}?

I suppose it can be faked with a method like ...

  static <E extends Enum<E>> NavigableSet<E> toNavigableSet(Set<E> backingSet)

... or maybe even like ...

  static <C extends Comparable<? super C>> NavigableSet<C> toNavigableSet(Set<C> backingSet)

... but not as efficiently, of course.  Anything I'm missing?

Thanks,

K

--
http://www/~kevinb/
_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: navigating enums

Joshua Bloch-2
Kevin,

I vaguely recall considering it, but I can't recall whether we
explicitly rejected it with good reason.  We were running very low on
time when I implemented EnumSet and EnumMap, and it's possible that
time played a role in our decision.  I'll tell you if I remember any
more than this (or discover anything in old e-mail logs).

       Regards,

       Josh

On 12/9/05, Kevin Bourrillion <[hidden email]> wrote:

> Since all enums are Comparable, why is it that Enum{Set,Map} don't implement
> Sorted{Set,Map}, and aren't being retrofitted for Navigable{Set,Map}?
>
> I suppose it can be faked with a method like ...
>
>   static <E extends Enum<E>> NavigableSet<E> toNavigableSet(Set<E>
> backingSet)
>
> ... or maybe even like ...
>
>   static <C extends Comparable<? super C>> NavigableSet<C>
> toNavigableSet(Set<C> backingSet)
>
> ... but not as efficiently, of course.  Anything I'm missing?
>
> Thanks,
>
> K
>
> --
> http://www/~kevinb/
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>
>

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: navigating enums

Remi Forax
Joshua Bloch a écrit :

> Kevin,
>
> I vaguely recall considering it, but I can't recall whether we
> explicitly rejected it with good reason.  We were running very low on
> time when I implemented EnumSet and EnumMap, and it's possible that
> time played a role in our decision.  I'll tell you if I remember any
> more than this (or discover anything in old e-mail logs).
>
>        Regards,
>
>        Josh

About enums, i've posted a patch last week
to avoid cloning universe when creating a new enum set.

https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=10491

If somebody wants to review it ?

Rémi Forax

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

RE: navigating enums

Mike Skells-3

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf
> Of Rémi Forax
> Sent: 10 December 2005 13:50
> To: [hidden email]
> Subject: Re: [concurrency-interest] navigating enums
>
> Joshua Bloch a écrit :
> > Kevin,
> >
> > I vaguely recall considering it, but I can't recall whether we
> > explicitly rejected it with good reason.  We were running
> very low on
> > time when I implemented EnumSet and EnumMap, and it's possible that
> > time played a role in our decision.  I'll tell you if I
> remember any
> > more than this (or discover anything in old e-mail logs).
> >
> >        Regards,
> >
> >        Josh
>
> About enums, i've posted a patch last week to avoid cloning
> universe when creating a new enum set.
>
> https://jdk-collaboration.dev.java.net/servlets/ProjectForumMe
> ssageView?forumID=1463&messageID=10491
>

I would love to, but I cant get access to the jdk-collaboration project, as
it is limitted to jdk-researchers. Is there any way that the patch can be
made available is another forum,
Or on this list


> If somebody wants to review it ?
>
> Rémi Forax
>
> _______________________________________________
> Concurrency-interest mailing list
> [hidden email]
> http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
>



_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest