RFR : 7129185 : (M) Add Collections.{checked|empty|unmodifiable}Navigable{Map|Set}

Mike Duigou mike.duigou at oracle.com
Tue Jun 11 00:32:31 UTC 2013


On Jun 10 2013, at 16:47 , Louis Wasserman wrote:

> Is there any reason that Collections.unmodifiableSortedSet() shouldn't just delegate to Collections.unmodifiableNavigableSet(), and similarly for the Maps?

Some of the implementations are pre-8 and almost certainly have serialized instances sitting on disk somewhere.

For the classes not introduced in Java 8 I opted to leave things exactly as they were since we won't ever be able to get rid of the existing impls. Also, if we added a fancy readResolve to EmptyMap that substituted a an EmptyNavigableMap for EmptySortedMap we would have a problem when we tried to serialized that as we would have forgotten what type it originally was and would serialize an EmptyNavigableMap rather than an EmptyMap instance. This couldn't be read by Java 7 or earlier.

A clean paper implementation of Collections would only require one Map and one Set implementing the most specialized interface but unfortunately we have to provide serialization compatibility.

Mike


> On Mon, Jun 10, 2013 at 4:36 PM, Mike Duigou <mike.duigou at oracle.com> wrote:
> I've done some further updates based upon feedback. I believe this is now "done" and ready for final review.
> 
> http://cr.openjdk.java.net/~mduigou/JDK-7129185/3/webrev/
> 
> I did find one inconsistency in the implementations SortedSet.headSet and SortedSet.tailSet methods.
> 
> Mike
> 
> 
> On Jun 7 2013, at 10:58 , Mike Duigou wrote:
> 
> > Hello all;
> >
> > I've incorporated feedback from previous rounds and expect to finalize this addition soon.
> >
> > http://cr.openjdk.java.net/~mduigou/JDK-7129185/2/webrev/
> >
> > Any review feedback or suggestions of additional tests welcome.
> >
> > Thanks,
> >
> > Mike
> >
> >
> 
> 
> 
> 
> -- 
> Louis Wasserman




More information about the core-libs-dev mailing list