Package org.pgcodekeeper.core.hasher
Class JavaHasher
java.lang.Object
org.pgcodekeeper.core.hasher.JavaHasher
- All Implemented Interfaces:
Hasher
Implementation of
Hasher interface using Java's standard hash code computation.
Uses prime number multiplication for combining hash values.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets the current hash result.voidput(boolean b) Adds a primitive boolean value to the hash computationvoidput(float f) Adds a primitive float value to the hash computationvoidput(int i) Adds a primitive int value to the hash computationvoidAdds a Boolean object to the hash computationvoidAdds an enum value to the hash computationvoid{Adds an Integer object to the hash computationvoidAdds a String value to the hash computationvoidAdds a List of Strings to the hash computation (order-sensitive)voidAdds a Map of String key-value pairs to the hash computationvoidAdds a Set of Strings to the hash computation (order-insensitive)voidAdds a hashable object to the hash computationvoidputOrdered(Collection<? extends IHashable> col) Adds a Collection of hashable objects with order sensitivityvoidputUnordered(Collection<? extends IHashable> col) Adds a Collection of hashable objects with order insensitivityvoidputUnordered(Map<String, ? extends IHashable> map) Adds an unordered Map of hashable objects to the hash computation.
-
Constructor Details
-
JavaHasher
public JavaHasher()
-
-
Method Details
-
put
public void put(boolean b) Description copied from interface:HasherAdds a primitive boolean value to the hash computation -
put
Adds a Boolean object to the hash computation -
put
Adds a String value to the hash computation -
put
public void put(int i) Description copied from interface:HasherAdds a primitive int value to the hash computation -
put
public void put(float f) Description copied from interface:HasherAdds a primitive float value to the hash computation -
put
{Adds an Integer object to the hash computation} -
put
Adds a hashable object to the hash computation -
put
Adds an enum value to the hash computation -
put
Description copied from interface:HasherAdds a Map of String key-value pairs to the hash computation -
put
Description copied from interface:HasherAdds a List of Strings to the hash computation (order-sensitive) -
put
Description copied from interface:HasherAdds a Set of Strings to the hash computation (order-insensitive) -
putOrdered
Description copied from interface:HasherAdds a Collection of hashable objects with order sensitivity- Specified by:
putOrderedin interfaceHasher- Parameters:
col- collection of objects implementing IHashable
-
putUnordered
Description copied from interface:HasherAdds a Collection of hashable objects with order insensitivity- Specified by:
putUnorderedin interfaceHasher- Parameters:
col- collection of objects implementing IHashable
-
getResult
public int getResult()Gets the current hash result.- Returns:
- the accumulated hash value
-
putUnordered
Adds an unordered Map of hashable objects to the hash computation.- Specified by:
putUnorderedin interfaceHasher- Parameters:
map- the map to hash (order-insensitive)
-