Using java.util.map

  • Thread starter Christopher Benson-Manica
  • Start date
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top