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 3499648
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:38:13+00:00 2026-05-18T12:38:13+00:00

Which is the best way to compute the hash code of a Map ,

  • 0

Which is the best way to compute the hash code of a Map, knowing that it may contain entry values of types such as: String, Integer, Object[] … ?

Map.hashCode() returns a shallow hash code. That means that if you have a String[] in your map, the Map.hashCode() will also use the hash returned by the String[]. Which, unfortunately, is not what I want (the Object.hashCode() implementation). But I want the Arrays.hashCode(String[]) implementation.

So which is the best, generic, approach to handle this ?

  • 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-18T12:38:13+00:00Added an answer on May 18, 2026 at 12:38 pm

    If you need to know if two maps contain the same values, you will need to write a deep comparison method. you shouldn’t be depending on hashCode.

    even with a perfect algorithm, there’s no way that every possible collection of every possible object could be uniquely represented by a single signed integer.

    Hashcode is just for collision reduction when used in collections, it is not supposed to be used to uniquely identify objects.

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

Sidebar

Related Questions

What's the best way to take some plain text (not PHP code) which contains
Which is Best way to send data to aspx page, and why ? using
What is the best way to determine which ASP.NET button was clicked on a
What would be the best way to resize images, which could be of any
I'm trying to determine the best way of having a PHP script determine which
Which is the best timer approach for a C# console batch application that has
which are the best tutorials, books, software and practices to start and manage a
Which component is best to use for receiving HTTP requests in Delphi application?
Which is the best API to use when accessing a WebCam in .Net? (I
Which is the best PHP library for openID integration?

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.