Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7402391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:43:50+00:00 2026-05-29T04:43:50+00:00

Is there some implementation of java.util.Map that does not uses HashCode? I have the

  • 0

Is there some implementation of java.util.Map that does not uses HashCode?

I have the following problem:

  1. I store an object associated to another object on a HashMap;
  2. Change a property from the key object used on step 1;
  3. As the hashcode is used to store the keys on the regular implementation of HashMap, when I perform a get() on the HashMap, I get null, because the old object hashCode was different at step 1.

Is there a solution for that? Or should I really use just immutable fields for my equals / hashCode methods?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:43:52+00:00Added an answer on May 29, 2026 at 4:43 am

    IdentityHashMap uses the Object identity instead of the hashCode; however that does mean that you require the original object used as key to retrieve the value of the map. Other options would be redefine the hashcode to exclude the mutable parts of the object, or – if you can’t redefine the hashCode for some reason – wrap the object in another object which provides a stable hashCode.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://en.wikipedia.org/wiki/Zephyr_(protocol) Does there exist a Java library or some sort of Java implementation of
Is there some interface that will allow for iteraction of arrays and java.util.Lists? Seeing
I'm looking for a KeyValuePair class in Java. Since java.util heavily uses interfaces there
Is there a good lightweight framework for java that provides the publish/subscribe pattern? Some
I see myself regularly confronted with the following problem. I have some kind of
I have a Java program that loads thirdparty class files (classes I did not
I'm looking for an on-disk implementation of java.util.Map . Nothing too fancy, just something
Does anyone know if some Java implementation of the JSON-RPC protocol exists with bidirectional
I've got a problem with some legacy Java code that renders PDF files. We're
There are already some discussions here on stackoverflow about Java generics, but I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.