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

  • Home
  • SEARCH
  • 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 9154583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:27:01+00:00 2026-06-17T12:27:01+00:00

I wrote a hashmap and filled it with key/value entries. The values are objects.

  • 0

I wrote a hashmap and filled it with key/value entries. The values are objects. The map contains at least 10 thousand entries. Later on when I want to fetch the values using a certain key, the map seems to not find this entry. This is too weird. Even each time it is failing at a different entry. What can I do to troubleshoot this? I am using weblogic as server. Should I play with any environment value?

  • 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-06-17T12:27:02+00:00Added an answer on June 17, 2026 at 12:27 pm

    Here are some things that may cause entries to be "lost":

    • Incorrectly implemented equals / hashcode methods on your key objects. These two methods need to conform to a "contract" for the hash table to work properly. The most important property is:

      key1.equals(key2) IMPLIES key1.hashcode() == key2.hashcode
      
    • Mutable key objects that are changed while the key is used in the map. In particular, if the key change cause the key’s hashcode to change, it will be lost. (In this case, the entries will show up if you iterate over the entire map. But the map operations that use has lookup won’t find them … because they are on the wrong hash chain.)

      The safest approach is to use a key class that is immutable.

    • Use of a map in a multi-threaded application without proper synchronization. This can cause corruption of the map data structure which could manifest as lost entries.

    • Some other part of your application that you are not aware of is removing the entries.


    The answers that state/stated that you have to override equals and hashcode are/were incorrect. There are situations where the Object implementations of these methods are exactly what is required. What you have to do is make sure that:

    1. you are using an appropriate form of key equality as required by your use-case, and
    2. your equals and hashcode conform to "the contract".

    What can I do to troubleshoot this?

    I’d recommend a code inspection to check the above issues.

    Debugging is another alternative. For instance, you could look to see if you can find the missing entries on the wrong hash chain. However, I suspect that approach could be a bit "hit and miss".

    I am using weblogic as server.

    Not relevant … unless you happen to be using some Map implementation class that is implemented by Weblogic rather than J2SE. (Look at the object’s classname.)

    Should I play with any environment value?

    No. It won’t help

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

Sidebar

Related Questions

Hello if you search in an HashMap<String,String> for a specific value of a key-value-pair,
I have map collection like this: Map<File,Boolean> status = new HashMap<File,Boolean>(); Wrote it to
I wrote a process explorer using C with GUI interface. I want to add
I wrote a PHP script that retrieves values from a MySQL Query. I used
A basic chat program I wrote has several key words that generate special actions,
I wrote a class that has a map of <String, Object> . I need
I want to use tuple returned from a method to make a new hashmap
I was looking for ways of sorting Map<String, Integer> by values. I found this
I wrote this hash map (this was a part of telephonic interview exercise), where
I write the following two functions I want to implement the functions with HashMap

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.