public final class HashCode extends Object implements Serializable, Cloneable, Comparable
Constructor and Description |
---|
HashCode()
Construct a new HashCode.
|
HashCode(int value)
Construct a new HashCode using the given int as the
base value.
|
Modifier and Type | Method and Description |
---|---|
HashCode |
add(boolean b)
Add the hash-code of the given value.
|
HashCode |
add(byte n)
Add the hash-code of the given value.
|
HashCode |
add(char n)
Add the hash-code of the given value.
|
HashCode |
add(double f)
Add the hash-code of the given value.
|
HashCode |
add(float f)
Add the hash-code of the given value.
|
HashCode |
add(int n)
Add the hash-code of the given value.
|
HashCode |
add(long n)
Add the hash-code of the given value.
|
HashCode |
add(Object obj)
Add the hash-code of the given object.
|
HashCode |
add(short n)
Add the hash-code of the given value.
|
Object |
clone()
Return a cloned copy of this HashCode.
|
int |
compareTo(int other)
Compares this object with the specified int for order.
|
int |
compareTo(Object obj)
Compares this object with the specified object for order.
|
boolean |
equals(Object obj)
Test the equality of this HashCode and another object.
|
static int |
generate(boolean value)
Generate a hash code for a boolean value.
|
static int |
generate(byte[] bytes)
Generate a hash code for a byte array.
|
static int |
generate(double value)
Generate a hash code for a double value.
|
static int |
generate(float value)
Generate a hash code for a float value.
|
static int |
generate(long value)
Generate a hash code for a long value.
|
static int |
generate(Object obj)
Generate a hash code for an object.
|
static int |
generate(Object[] array)
Generate a shallow hash code for an object array.
|
static int |
generate(Object[] array,
boolean deep)
Generate a hash code for an object array.
|
int |
hashCode()
Get the hash-code.
|
String |
toString()
Return a string representation of this HashCode.
|
public HashCode(int value)
value
- int to use as the base value.public HashCode()
public HashCode add(boolean b)
b
- Value to get hash-code from.public HashCode add(byte n)
n
- Value to get hash-code from.public HashCode add(char n)
n
- Value to get hash-code from.public HashCode add(short n)
n
- Value to get hash-code from.public HashCode add(int n)
n
- Value to get hash-code from.public HashCode add(long n)
n
- Value to get hash-code from.public HashCode add(float f)
f
- Value to get hash-code from.public HashCode add(double f)
f
- Value to get hash-code from.public HashCode add(Object obj)
obj
- Value to get hash-code from.public int hashCode()
public int compareTo(int other)
other
- Value to compare with.public int compareTo(Object obj) throws ClassCastException
compareTo
in interface Comparable
obj
- Value to compare with.ClassCastException
- Object is not a HashCode.public boolean equals(Object obj)
public String toString()
public Object clone()
public static int generate(boolean value)
value
- Boolean value to generate hash code from.public static int generate(long value)
value
- Long value to generate hash code from.public static int generate(double value)
value
- Double value to generate hash code from.public static int generate(float value)
value
- Float value to generate hash code from.public static int generate(byte[] bytes)
bytes
- An array of bytes to generate a hash code from.public static int generate(Object[] array, boolean deep)
Does not handle nested primitive array elements.
array
- Array to generate hashcode for.deep
- True to traverse elements which are arrays to
determine the elements hash code.public static int generate(Object[] array)
array
- Array to generate hashcode for.public static int generate(Object obj)
obj
- Object to generate hashcode for.Copyright © 2018 JBoss by Red Hat. All rights reserved.