Example usage for java.lang Comparable hashCode

List of usage examples for java.lang Comparable hashCode

Introduction

In this page you can find the example usage for java.lang Comparable hashCode.

Prototype

@HotSpotIntrinsicCandidate
public native int hashCode();

Source Link

Document

Returns a hash code value for the object.

Usage

From source file:com.aurel.track.fieldType.runtime.base.CustomSelectComparable.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    if (comparableMap != null) {
        Iterator<Integer> itrComparableMap = comparableMap.keySet().iterator();
        while (itrComparableMap.hasNext()) {
            Integer key = itrComparableMap.next();
            Comparable value0 = comparableMap.get(key);
            result = prime * result + ((value0 == null) ? 0 : value0.hashCode());
        }/*from w  w  w. j a  va2  s  .  c o  m*/
    } else {
        result = prime * result;
    }
    return result;
}

From source file:com.aurel.track.fieldType.runtime.base.CompositeComparable.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    if (comparableMap != null) {
        for (int i = 0; i < numberOfParts; i++) {
            Integer parameterCode = new Integer(i + 1);
            Comparable value0 = comparableMap.get(parameterCode);
            result = prime * result + ((value0 == null) ? 0 : value0.hashCode());
        }/* w  ww. ja v  a2  s.  c  om*/
    } else {
        result = prime * result;
    }
    return result;
}