[concurrency-interest] Immutable Entry objects in j.u.TreeMap
ashwin.jayaprakash at gmail.com
Mon Apr 5 18:47:18 EDT 2010
I was looking at the JDK 6 java.util.TreeMap source code to see if any of
the xxEntry methods were returning actual Entry objects or immutable
snapshots like in j.u.c.ConcurrentSkipMap. I see that the return values in
TreeMap are confusing. I hope someone here can throw some light on this:
1) entrySet, headMap, tailMap - seem to return Map.Entry references that are
still referred to by the map. There's no confusion here.
2) firstEntry, lastEntry, lowerEntry, floorEntry...ceilingEntry - these wrap
the actual Map.Entry objects with exportEntry(). So, these are actually
returning AbstractMap.SimpleImmutableEntry instances. Why the difference?
Why isn't setValue(xx) not allowed on these entries?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest