Java Utililty Methods Array Hash Code

List of utility methods to do Array Hash Code

Description

The list of methods to do Array Hash Code are organized into topic(s).

Method

inthashCode(final Object[] array1)
hash Code
if (array1 == null) {
    return 0;
return Arrays.hashCode(array1);
inthashCode(Map a)
Implements hashCode for map of string arrays The map of string arrays does't work with hashCode.
int hash = 0;
for (Map.Entry<String, String[]> entry : a.entrySet())
    hash += Arrays.hashCode(entry.getValue());
return hash;
inthashCode(Object array)
Hashes an array.
int hashCode;
if (array == null) {
    hashCode = 0;
} else if (array instanceof byte[]) {
    hashCode = Arrays.hashCode((byte[]) array);
} else if (array instanceof short[]) {
    hashCode = Arrays.hashCode((short[]) array);
} else if (array instanceof int[]) {
...
inthashCode(Object array)
Computes a hash code for the given array based on its content instead of on its identity.
Class<?> arrayType = array.getClass();
if (!arrayType.isArray()) {
    throw new IllegalArgumentException("specified object is not an array");
Class<?> componentType = arrayType.getComponentType();
if (componentType.isPrimitive()) {
    if (componentType == boolean.class) {
        return Arrays.hashCode((boolean[]) array);
...
inthashCode(String[] names, Object[] values)
Computes a descriptor hashcode from its names and values.
int hash = 0;
for (int i = 0; i < names.length; i++) {
    Object v = values[i];
    int h;
    if (v == null) {
        h = 0;
    } else if (v instanceof Object[]) {
        h = Arrays.deepHashCode((Object[]) v);
...
StringprintArray(byte[] array, boolean withHash)
print Array
if (array == null)
    return "null";
int limit = 8;
StringBuilder sb = new StringBuilder();
sb.append("[B0x");
if (array.length <= limit || IS_ARRAYS_DEBUG) {
    sb.append(toHexString(array));
    if (withHash) {
...