[concurrency-interest] Immutable Entry objects in j.u.TreeMap

Doug Lea dl at cs.oswego.edu
Tue Apr 6 06:58:42 EDT 2010


On 04/05/10 19:33, Ashwin Jayaprakash wrote:

> 2) firstEntry, lastEntry etc keep creating tiny objects for every call.
> This is a problem, don't you think?

It would be a bigger problem to return internal nodes that could
be modified from outside the map.
Note that if want to trade time for space, you can
call first, last etc instead of firstEntry lastEntry, etc, and
then call map.get of the returned key when you need value.

-Doug




More information about the Concurrency-interest mailing list