Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of Hash Code in Java apart from Collection Framework

 
Ninad Kulkarni
Ranch Hand
Posts: 802
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to know use of hash code in Java other than Collection Framework.
I googled many websites but they are using collection framework so want to know that any other use of hash code in Java without collection framework.
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maps are used in Jasper Reporting using java. Normally HashMap. Parameters to the report are send using a Map.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49781
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The CRC, SHA and similar calculations are similar to hash codes. They are used to confirm the integrity of downloads and to confirm passwords.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15438
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The hashCode() method in class Object really only exists to support hash-based collections such as HashMap and HashSet.

The hashes that Campbell mentions (CRC, SHA etc.) are not related to the hashCode() method of class Object. Those are cryptographic hash functions, and even though they also have the word "hash" in their name they're used for other purposes and have other requirements than what hashCode() normally is used for.
 
Ninad Kulkarni
Ranch Hand
Posts: 802
Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Campbell and Jesper
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic