Skip to content

A simple implementation that uses custom class as HashMap key

License

Notifications You must be signed in to change notification settings

selcuksert/hashkey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hashkey

A simple implementation that uses object based on custom classes as HashMap key.

The hash code generation and equality check is done via Apache Commons Lang HashCodeBuilder and EqualsBuilder.

Sample Console Output

Keys equal? [true]
Hash codes equal? [true]
==============
Validate whether generated hash codes are always same:
Hash code [dataKey1]: 70329913
Hash code [dataKey1]: 70329913
Hash code [dataKey1]: 70329913
Hash code [dataKey2]: 70329913
Hash code [dataKey2]: 70329913
Hash code [dataKey2]: 70329913
==============
Added data with dataKey1.
==============
Query data with dataKey2:
[1000, 2000, 3000, 4000, 5000]
==============
Replaced data with dataKey2:
[5000, 4000, 3000, 2000, 1000]
==============
Query data with dataKey1:
[5000, 4000, 3000, 2000, 1000]

About

A simple implementation that uses custom class as HashMap key

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages