Java Code Examples for java.util.Arrays#deepHashCode()

The following examples show how to use java.util.Arrays#deepHashCode() .
Example 1
Project: attic-apex-malhar   File: GPOMutable.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public int hashCode()
{
  int hash = 7;
  hash = 23 * hash + Arrays.hashCode(this.fieldsBoolean);
  hash = 23 * hash + Arrays.hashCode(this.fieldsCharacter);
  hash = 23 * hash + Arrays.hashCode(this.fieldsByte);
  hash = 23 * hash + Arrays.hashCode(this.fieldsShort);
  hash = 23 * hash + Arrays.hashCode(this.fieldsInteger);
  hash = 23 * hash + Arrays.hashCode(this.fieldsLong);
  hash = 23 * hash + Arrays.hashCode(this.fieldsFloat);
  hash = 23 * hash + Arrays.hashCode(this.fieldsDouble);
  hash = 23 * hash + Arrays.deepHashCode(this.fieldsString);
  hash = 23 * hash + (this.fieldDescriptor != null ? this.fieldDescriptor.hashCode() : 0);
  return hash;
}
 
Example 2
Project: tedroid   File: Tetromino.java    License: Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + (hasRotation ? 1231 : 1237);
    result = prime * result + Arrays.deepHashCode(shapeMatrix);
    return result;
}
 
Example 3
Project: gemfirexd-oss   File: StructBag.java    License: Apache License 2.0 5 votes vote down vote up
public final int computeHashCode(Object o) {
  // throws ClassCastException if not Object[]
  // compute hash code based on all elements
  if (!(o instanceof Object[])) {
    throw new ClassCastException(LocalizedStrings.StructBag_EXPECTED_AN_OBJECT_BUT_ACTUAL_IS_0.toLocalizedString(o.getClass().getName()));
  }
  Object[] oa = (Object[])o;
  return Arrays.deepHashCode(oa);
}
 
Example 4
Project: lsp4j   File: SetExceptionBreakpointsArguments.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((this.filters== null) ? 0 : Arrays.deepHashCode(this.filters));
  return prime * result + ((this.exceptionOptions== null) ? 0 : Arrays.deepHashCode(this.exceptionOptions));
}
 
Example 5
Project: jtk   File: OrbitViewLighting.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public int hashCode() {
  int result = Arrays.hashCode(_lightSet);
  result = 31 * result + Arrays.hashCode(_lightTypes);
  result = 31 * result + Arrays.deepHashCode(_ambients);
  result = 31 * result + Arrays.deepHashCode(_speculars);
  result = 31 * result + Arrays.deepHashCode(_diffuses);
  result = 31 * result + Arrays.deepHashCode(_positions);
  return result;
}
 
Example 6
Project: TencentKona-8   File: CompositeDataSupport.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the hash code value for this <code>CompositeDataSupport</code> instance.
 * <p>
 * The hash code of a <code>CompositeDataSupport</code> instance is the sum of the hash codes
 * of all elements of information used in <code>equals</code> comparisons
 * (ie: its <i>composite type</i> and all the item values).
 * <p>
 * This ensures that <code> t1.equals(t2) </code> implies that <code> t1.hashCode()==t2.hashCode() </code>
 * for any two <code>CompositeDataSupport</code> instances <code>t1</code> and <code>t2</code>,
 * as required by the general contract of the method
 * {@link Object#hashCode() Object.hashCode()}.
 * <p>
 * Each item value's hash code is added to the returned hash code.
 * If an item value is an array,
 * its hash code is obtained as if by calling the
 * {@link java.util.Arrays#deepHashCode(Object[]) deepHashCode} method
 * for arrays of object reference types or the appropriate overloading
 * of {@code Arrays.hashCode(e)} for arrays of primitive types.
 *
 * @return the hash code value for this <code>CompositeDataSupport</code> instance
 */
@Override
public int hashCode() {
    int hashcode = compositeType.hashCode();

    for (Object o : contents.values()) {
        if (o instanceof Object[])
            hashcode += Arrays.deepHashCode((Object[]) o);
        else if (o instanceof byte[])
            hashcode += Arrays.hashCode((byte[]) o);
        else if (o instanceof short[])
            hashcode += Arrays.hashCode((short[]) o);
        else if (o instanceof int[])
            hashcode += Arrays.hashCode((int[]) o);
        else if (o instanceof long[])
            hashcode += Arrays.hashCode((long[]) o);
        else if (o instanceof char[])
            hashcode += Arrays.hashCode((char[]) o);
        else if (o instanceof float[])
            hashcode += Arrays.hashCode((float[]) o);
        else if (o instanceof double[])
            hashcode += Arrays.hashCode((double[]) o);
        else if (o instanceof boolean[])
            hashcode += Arrays.hashCode((boolean[]) o);
        else if (o != null)
            hashcode += o.hashCode();
    }

    return hashcode;
}
 
Example 7
Project: herddb   File: AggregateOp.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
    int hash = 7;
    hash = 71 * hash + Arrays.deepHashCode(this.values);
    return hash;
}
 
Example 8
Project: netcdf-java   File: CrawlableDatasetAmazonS3.java    License: BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public int hashCode() {
  return Arrays.deepHashCode(new Object[] {this.getS3URI(), this.getConfigObject()});
}
 
Example 9
Project: commons-jcs   File: GeneratedCacheKeyImpl.java    License: Apache License 2.0 4 votes vote down vote up
public GeneratedCacheKeyImpl(final Object[] parameters)
{
    this.params = parameters;
    this.hash = Arrays.deepHashCode(parameters);
}
 
Example 10
Project: terracotta-platform   File: DiagnosticRequest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
  int result = Objects.hash(serviceInterface, methodName);
  result = 31 * result + Arrays.deepHashCode(arguments);
  return result;
}
 
Example 11
Project: jdk8u_jdk   File: ResultRecord.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Arrays.deepHashCode(toArray());
}
 
Example 12
Project: symja_android_library   File: DataCollectorND.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public int hashCode() {
    return name.hashCode() ^ ((Arrays.hashCode(means))) ^ ((2 * Arrays.hashCode(maxX))) ^ ((3 * Arrays.hashCode(minX)))
            ^ ((5 * Arrays.deepHashCode(covar)));
}
 
Example 13
Project: hottub   File: ResultRecord.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Arrays.deepHashCode(toArray());
}
 
Example 14
Project: tutorials   File: Board.java    License: MIT License 4 votes vote down vote up
@Override
public int hashCode() {
    return Arrays.deepHashCode(board);
}
 
Example 15
Project: helidon-build-tools   File: CommandParser.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
    int hash = 5;
    hash = 73 * hash + Arrays.deepHashCode(this.rawArgs);
    return hash;
}
 
Example 16
Project: lsp4j   File: SetFunctionBreakpointsArguments.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
@Pure
public int hashCode() {
  return 31 * 1 + ((this.breakpoints== null) ? 0 : Arrays.deepHashCode(this.breakpoints));
}
 
Example 17
Project: stratosphere   File: TupleTypeInfo.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
	return this.types.hashCode() ^ Arrays.deepHashCode(this.types);
}
 
Example 18
Project: TencentKona-8   File: ResultRecord.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Arrays.deepHashCode(toArray());
}
 
Example 19
Project: spanner-jdbc   File: CloudSpannerArray.java    License: MIT License 4 votes vote down vote up
@Override
public int hashCode() {
  return this.type.hashCode() ^ Arrays.deepHashCode((Object[]) data);
}
 
Example 20
Project: lsp4j   File: GotoTargetsResponse.java    License: Eclipse Public License 2.0 4 votes vote down vote up
@Override
@Pure
public int hashCode() {
  return 31 * 1 + ((this.targets== null) ? 0 : Arrays.deepHashCode(this.targets));
}