Example usage for java.util Arrays deepHashCode

List of usage examples for java.util Arrays deepHashCode

Introduction

In this page you can find the example usage for java.util Arrays deepHashCode.

Prototype

public static int deepHashCode(Object a[]) 

Source Link

Document

Returns a hash code based on the "deep contents" of the specified array.

Usage

From source file:org.apache.hadoop.mapreduce.counters.FrameworkCounterGroup.java

@Override
public synchronized int hashCode() {
    // need to be deep as counters is an array
    return Arrays.deepHashCode(new Object[] { enumClass, counters, displayName });
}

From source file:com.opengamma.analytics.financial.model.volatility.smile.fitting.sabr.ForexSmileDeltaSurfaceDataBundle.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _forwardCurve.hashCode();
    result = prime * result + Arrays.deepHashCode(_vols);
    result = prime * result + Arrays.deepHashCode(_strikes);
    result = prime * result + Arrays.hashCode(_expiries);
    return result;
}

From source file:com.opengamma.analytics.financial.forex.method.FXMatrix.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _currencies.hashCode();
    result = prime * result + Arrays.deepHashCode(_fxRates);
    return result;
}

From source file:org.apache.geode.pdx.internal.PdxInstanceImpl.java

@Override
public int hashCode() {
    if (this.cachedHashCode != UNUSED_HASH_CODE) {
        // Already computed.
        return this.cachedHashCode;
    }/*from   w  w  w  . j  a va  2 s . c  o m*/
    PdxReaderImpl ur = getUnmodifiableReader();

    // Compute hash code.
    Collection<PdxField> fields = ur.getPdxType().getSortedIdentityFields();
    int hashCode = 1;
    for (PdxField ft : fields) {
        switch (ft.getFieldType()) {
        case CHAR:
        case BOOLEAN:
        case BYTE:
        case SHORT:
        case INT:
        case LONG:
        case DATE:
        case FLOAT:
        case DOUBLE:
        case STRING:
        case BOOLEAN_ARRAY:
        case CHAR_ARRAY:
        case BYTE_ARRAY:
        case SHORT_ARRAY:
        case INT_ARRAY:
        case LONG_ARRAY:
        case FLOAT_ARRAY:
        case DOUBLE_ARRAY:
        case STRING_ARRAY:
        case ARRAY_OF_BYTE_ARRAYS: {
            ByteSource buffer = ur.getRaw(ft);
            if (!buffer.equals(ByteSourceFactory.create(ft.getFieldType().getDefaultBytes()))) {
                hashCode = hashCode * 31 + buffer.hashCode();
            }
            break;
        }
        case OBJECT_ARRAY: {
            Object[] oArray = ur.readObjectArray(ft);
            if (oArray != null) {
                // default value of null does not modify hashCode.
                hashCode = hashCode * 31 + Arrays.deepHashCode(oArray);
            }
            break;
        }
        case OBJECT: {
            Object objectValue = ur.readObject(ft);
            if (objectValue == null) {
                // default value of null does not modify hashCode.
            } else if (objectValue.getClass().isArray()) {
                Class<?> myComponentType = objectValue.getClass().getComponentType();
                if (myComponentType.isPrimitive()) {
                    ByteSource buffer = getRaw(ft);
                    hashCode = hashCode * 31 + buffer.hashCode();
                } else {
                    hashCode = hashCode * 31 + Arrays.deepHashCode((Object[]) objectValue);
                }
            } else {
                hashCode = hashCode * 31 + objectValue.hashCode();
            }
            break;
        }
        default:
            throw new InternalGemFireException("Unhandled field type " + ft.getFieldType());
        }
    }
    int result = (hashCode == UNUSED_HASH_CODE) ? (hashCode + 1) : hashCode;
    this.cachedHashCode = result;
    return result;
}

From source file:io.fouad.jtb.core.beans.Message.java

@Override
public int hashCode() {
    int result = messageId;
    result = 31 * result + (from != null ? from.hashCode() : 0);
    result = 31 * result + date;/*from  w  w w  .ja  v a 2s  .c  om*/
    result = 31 * result + (chat != null ? chat.hashCode() : 0);
    result = 31 * result + (forwardFrom != null ? forwardFrom.hashCode() : 0);
    result = 31 * result + (forwardFromChat != null ? forwardFromChat.hashCode() : 0);
    result = 31 * result + (forwardDate != null ? forwardDate.hashCode() : 0);
    result = 31 * result + (replyToMessage != null ? replyToMessage.hashCode() : 0);
    result = 31 * result + editDate;
    result = 31 * result + (text != null ? text.hashCode() : 0);
    result = 31 * result + Arrays.deepHashCode(entities);
    result = 31 * result + (audio != null ? audio.hashCode() : 0);
    result = 31 * result + (document != null ? document.hashCode() : 0);
    result = 31 * result + Arrays.deepHashCode(photo);
    result = 31 * result + (sticker != null ? sticker.hashCode() : 0);
    result = 31 * result + (video != null ? video.hashCode() : 0);
    result = 31 * result + (voice != null ? voice.hashCode() : 0);
    result = 31 * result + (caption != null ? caption.hashCode() : 0);
    result = 31 * result + (contact != null ? contact.hashCode() : 0);
    result = 31 * result + (location != null ? location.hashCode() : 0);
    result = 31 * result + (venue != null ? venue.hashCode() : 0);
    result = 31 * result + (newChatMember != null ? newChatMember.hashCode() : 0);
    result = 31 * result + (leftChatMember != null ? leftChatMember.hashCode() : 0);
    result = 31 * result + (newChatTitle != null ? newChatTitle.hashCode() : 0);
    result = 31 * result + Arrays.deepHashCode(newChatPhoto);
    result = 31 * result + (deleteChatPhoto != null ? deleteChatPhoto.hashCode() : 0);
    result = 31 * result + (groupChatCreated != null ? groupChatCreated.hashCode() : 0);
    result = 31 * result + (superGroupChatCreated != null ? superGroupChatCreated.hashCode() : 0);
    result = 31 * result + (channelChatCreated != null ? channelChatCreated.hashCode() : 0);
    result = 31 * result + (migrateToChatId != null ? migrateToChatId.hashCode() : 0);
    result = 31 * result + (migrateFromChatId != null ? migrateFromChatId.hashCode() : 0);
    result = 31 * result + (pinnedMessage != null ? pinnedMessage.hashCode() : 0);
    return result;
}

From source file:com.paperculture.mongrel2.Handler.java

private static int hash(Object... objects) {
    return Arrays.deepHashCode(objects);
}

From source file:de.bund.bfr.knime.node.editableTable.JSONDataTable.java

/**
 * {@inheritDoc}/*w  w  w.java 2  s.  com*/
 */
@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Arrays.deepHashCode(m_extensions);
    result = prime * result + Arrays.hashCode(m_rows);
    result = prime * result + ((m_spec == null) ? 0 : m_spec.hashCode());
    return result;
}