R
Robert Klemme
Robert Klemme wrote:
I don't really understand the attraction of using Entry.
The cost of the second lookup is likely to be very low. The HashMap code
is in the instruction cache. The relevant portions of the hash table are
in the data cache. The same branches will be taken and not-taken as in
the original lookup.
The cost of creating a new Integer object each time a count increments,
and garbage collecting the old one, may be greater than the cost of the
second lookup. Using Entry does nothing about that.
The mutable counter solution seems simple, clean, and obvious to me.
Completely agree with you. My posting just made a comment as to how
complex it might be to add Entry lookup.
Kind regards
robert