Example usage for java.util Arrays hashCode

List of usage examples for java.util Arrays hashCode

Introduction

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

Prototype

public static int hashCode(Object a[]) 

Source Link

Document

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

Usage

From source file:org.kaaproject.kaa.server.common.dao.model.sql.SdkKey.java

@Override
public int hashCode() {
    int result = token != null ? token.hashCode() : 0;
    result = 31 * result + (data != null ? Arrays.hashCode(data) : 0);
    result = 31 * result + (application != null ? application.hashCode() : 0);
    return result;
}

From source file:com.opengamma.analytics.math.interpolation.data.KrigingInterpolatorDataBundle.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = super.hashCode();
    result = prime * result + _decomp.hashCode();
    result = prime * result + _variogram.hashCode();
    result = prime * result + Arrays.hashCode(_weights);
    return result;
}

From source file:org.everit.osgi.webconsole.configuration.DisplayedAttribute.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((description == null) ? 0 : description.hashCode());
    result = prime * result + ((id == null) ? 0 : id.hashCode());
    result = prime * result + maxOccurences;
    result = prime * result + ((name == null) ? 0 : name.hashCode());
    result = prime * result + ((options == null) ? 0 : options.hashCode());
    result = prime * result + ((type == null) ? 0 : type.hashCode());
    result = prime * result + Arrays.hashCode(value);
    return result;
}

From source file:org.apache.hadoop.hdfs.util.EnumCounters.java

@Override
public synchronized int hashCode() {
    return Arrays.hashCode(counters);
}

From source file:com.opengamma.financial.analytics.ircurve.calcconfig.MultiCurveCalculationConfig.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _calculationConfigName.hashCode();
    result = prime * result + _calculationMethod.hashCode();
    result = prime * result//from  w  w w.  ja  v a  2  s  .c  o m
            + (_exogenousConfigAndCurveNames == null ? 0 : _exogenousConfigAndCurveNames.hashCode());
    result = prime * result + _target.hashCode();
    result = prime * result + Arrays.hashCode(_yieldCurveNames);
    result = prime * result
            + (_curveExposuresForInstruments == null ? 0 : _curveExposuresForInstruments.hashCode());
    return result;
}

From source file:org.jboss.aerogear.android.pipe.loader.LoaderAdapter.java

@Override
public void read(String idx, Callback<T> callback) {
    ReadFilter filter = new ReadFilter();
    filter.setLinkUri(URI.create(idx));

    int id = Arrays.hashCode(new Object[] { name, filter, callback });
    Bundle bundle = new Bundle();
    bundle.putSerializable(CALLBACK, callback);
    bundle.putSerializable(FILTER, filter);
    bundle.putSerializable(METHOD, Methods.READ_ID);
    manager.initLoader(id, bundle, this);
}

From source file:at.pcgamingfreaks.Version.java

/**
 * @param version A string representing this version. Must be in the format: {@value #VERSION_STING_FORMAT}
 * @param ignoreOptionalTags Ignores tags like -alpha for the version comparison.
 * @throws InvalidVersionStringException The exception is thrown when the given string doesn't match the required format.
 *///w  ww .ja v a2  s .  co  m
public Version(@NotNull String version, boolean ignoreOptionalTags) throws InvalidVersionStringException {
    //noinspection ConstantConditions
    if (version == null || version.isEmpty() || !isValidVersionString(version))
        throw new InvalidVersionStringException(
                "The version string must be in the format: " + VERSION_STING_FORMAT);
    if (version.startsWith("v") || version.startsWith("V"))
        version = version.substring(1);
    this.rawVersion = version;
    // Prepare data
    String[] comps = version.split("-", 2);
    version = comps[0].replaceAll("(\\.0)*$", "");
    String options = comps.length > 1 ? comps[1] : "";
    this.optionalTags = options.split("-");
    comps = version.split("\\.");
    List<String> tags = (!ignoreOptionalTags) ? getAll(this.optionalTags, PRE_RELEASE_TAGS) : null;
    boolean notAFinalVersion = !ignoreOptionalTags && tags.size() > 0;
    this.version = new int[notAFinalVersion ? comps.length + 1 : comps.length];
    for (int i = 0; i < comps.length; i++) {
        this.version[i] = Integer.parseInt(comps[i]);
    }
    if (notAFinalVersion) {
        int last = 0;
        for (String str : tags) {
            if (last == 0)
                last = Integer.MAX_VALUE;
            int preReleaseTagNumber = 0;
            String tag = str.toLowerCase();
            if (str.matches(PRE_RELEASE_TAG_FORMAT)) {
                preReleaseTagNumber = Integer.parseInt(tag.substring(tag.length() - 1));
                tag = tag.substring(0, tag.length() - 1);
            }
            last = (last - PRE_RELEASE_TAG_VALUE_RESOLUTION.get(tag)) + preReleaseTagNumber;
        }
        this.version[this.version.length - 1] = last;
        if (last > 0) {
            for (int i = this.version.length - 2; i >= 0; i--) {
                if (this.version[i] > 0 || i == 0) {
                    this.version[i]--;
                    break;
                }
            }
        }
    }
    this.hashCode = Arrays.hashCode(this.version);
}

From source file:edu.vt.middleware.ldap.LdapUtil.java

/**
 * Computes a hash code for the supplied object. Checks for arrays of type
 * byte[] and Object[] and delegates to the {@link Arrays} class. Otherwise
 * {@link Object#hashCode()} is invoked.
 *
 * @param  object  to calculate hash code for
 *
 * @return  hash code/*from www. j  a v a2  s  .  c  o  m*/
 */
private static int computeHashCode(final Object object) {
    int hc = 0;
    if (object instanceof byte[]) {
        hc += Arrays.hashCode((byte[]) object);
    } else if (object instanceof Object[]) {
        hc += Arrays.hashCode((Object[]) object);
    } else {
        hc += object.hashCode();
    }
    return hc;
}

From source file:com.alibaba.wasp.EntityGroupInfo.java

private void setHashCode() {
    int result = Arrays.hashCode(this.entityGroupName);
    result ^= this.entityGroupId;
    result ^= Arrays.hashCode(this.startKey);
    result ^= Arrays.hashCode(this.endKey);
    result ^= Boolean.valueOf(this.offLine).hashCode();
    result ^= Arrays.hashCode(this.tableName);
    this.hashCode = result;
}

From source file:org.commonjava.cartographer.graph.spi.neo4j.model.Neo4jGraphPath.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Long.valueOf(startNode).hashCode();
    result = prime * result + Long.valueOf(endNode).hashCode();
    result = prime * result + Arrays.hashCode(relationships);
    return result;
}