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

The following examples show how to use java.util.Arrays#deepHashCode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GPOMutable.java    From attic-apex-malhar with 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
Source File: CompositeDataSupport.java    From TencentKona-8 with 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 3
Source File: Tetromino.java    From tedroid with 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 4
Source File: StructBag.java    From gemfirexd-oss with 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 5
Source File: OrbitViewLighting.java    From jtk with 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
Source File: SetExceptionBreakpointsArguments.java    From lsp4j with 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 7
Source File: Board.java    From tutorials with MIT License 4 votes vote down vote up
@Override
public int hashCode() {
    return Arrays.deepHashCode(board);
}
 
Example 8
Source File: GotoTargetsResponse.java    From lsp4j with 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));
}
 
Example 9
Source File: CloudSpannerArray.java    From spanner-jdbc with MIT License 4 votes vote down vote up
@Override
public int hashCode() {
  return this.type.hashCode() ^ Arrays.deepHashCode((Object[]) data);
}
 
Example 10
Source File: ResultRecord.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Arrays.deepHashCode(toArray());
}
 
Example 11
Source File: TupleTypeInfo.java    From stratosphere with Apache License 2.0 4 votes vote down vote up
@Override
public int hashCode() {
	return this.types.hashCode() ^ Arrays.deepHashCode(this.types);
}
 
Example 12
Source File: SetFunctionBreakpointsArguments.java    From lsp4j with 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 13
Source File: CommandParser.java    From helidon-build-tools with 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 14
Source File: AggregateOp.java    From herddb with 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 15
Source File: ResultRecord.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Arrays.deepHashCode(toArray());
}
 
Example 16
Source File: DataCollectorND.java    From symja_android_library with 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 17
Source File: ResultRecord.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public int hashCode() {
    return Arrays.deepHashCode(toArray());
}
 
Example 18
Source File: DiagnosticRequest.java    From terracotta-platform with 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 19
Source File: GeneratedCacheKeyImpl.java    From commons-jcs with Apache License 2.0 4 votes vote down vote up
public GeneratedCacheKeyImpl(final Object[] parameters)
{
    this.params = parameters;
    this.hash = Arrays.deepHashCode(parameters);
}
 
Example 20
Source File: CrawlableDatasetAmazonS3.java    From netcdf-java with 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()});
}