Compares two objects based on their hashcode.

@param <T> the type of object being compared
@return A simplistic comparator that compares hash code values
180330
public static <T> SerializableComparator<T> hashCodeComparator() {
      return (o1, o2) -> {
         if (o1 == o2) {
            return 0;
         } else if (o1 == null) {
            return 1;
         } else if (o2 == null) {
            return -1;
         }
         return Integer.compare(o1.hashCode(), o2.hashCode());
      };
   }
936245
@SuppressWarnings({ "unchecked", "rawtypes" })
	public static <T> int compare(T o1, T o2, boolean isNullGreater) {
		if (o1 == o2) {
			return 0;
		} else if (null == o1) {// null 排在后面
			return isNullGreater ? 1 : -1;
		} else if (null == o2) {
			return isNullGreater ? -1 : 1;
		}
		
		if(o1 instanceof Comparable && o2 instanceof Comparable) {
			//如果bean可比较，直接比较bean
			return ((Comparable)o1).compareTo(o2);
		}
		
		if(o1.equals(o2)) {
			return 0;
		}
		
		int result = Integer.compare(o1.hashCode(), o2.hashCode());
		if(0 == result) {
			result = compare(o1.toString(), o2.toString());
		}
		
		return result;
	}
542908
@ReplacedBy("com.google.common.collect.Ordering.natural().nullsLast()")
    public static final <T extends Comparable<?>> Comparator<T> comparable ()
    {
        @SuppressWarnings("unchecked") Comparator<T> comp = (Comparator<T>)COMPARABLE;
        return comp;
    }
441119
public static <T extends MethodDescription> ElementMatcher.Junction<T> isEquals() {
        return named("equals").and(takesArguments(TypeDescription.OBJECT)).and(returns(boolean.class));
    }
671191
@NotNull
    public ComparatorCompat<T> thenComparing(@NotNull final Comparator<? super T> other) {
        return new ComparatorCompat<T>(thenComparing(comparator, other));
    }
208520
@Pure
	protected int compareSegments(ST s1, ST s2) {
		assert s1 != null && s2 != null;
		return s1.hashCode() - s2.hashCode();
	}
793431
public int compareTo(Object o) {
    UTF8 that = (UTF8)o;
    return WritableComparator.compareBytes(bytes, 0, length,
                                           that.bytes, 0, that.length);
  }
1285317
static <T, S extends Sequence> Comparator<T>
    getComparatorOfObjectsRegardingSequences(final Comparator<T> objectComparator, final SequenceExtractor<T, S> extractor) {
        return new Comparator<T>() {
            @Override
            public int compare(T o1, T o2) {
                int i = objectComparator.compare(o2, o1);  // Reverse comparison
                return i == 0 ?
                        extractor.getSequence(o2).compareTo(extractor.getSequence(o1))
                        : i;
            }
        };
    }
589719
public int compareTo(ByteArrayPair a) {
    final int key_compare = Bytes.memcmpMaybeNull(this.key, a.key);
    if (key_compare == 0) {
      return Bytes.memcmpMaybeNull(this.value, a.value);
    }
    return key_compare;
  }
1258553
public static int compareTo(byte[] b1, int s1, int l1, byte[] b2, int s2,
      int l2) {
    return LexicographicalComparerHolder.BEST_COMPARER.compareTo(
        b1, s1, l1, b2, s2, l2);
  }
1087361
public static <T extends Comparable<T>> int checkCompare(T a, T b) {
        return a == null ?
                b == null ? 0 : -1 :
                    b == null ? 1 : a.compareTo(b);
      }
1813
@Override
    public boolean isEqual(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof TemporalParameter)) {
            return false;
        }

        TemporalParameter p = (TemporalParameter) o;
        return super.isEqual(p)
                && (this.value == p.value
                || (this.value != null && this.value.equals(p.value)));
    }
209309
@Override
    public int compareTo(Tag tag) {
        int keyResult = this.key.compareTo(tag.key);

        if (keyResult != 0) {
            return keyResult;
        }

        return this.value.compareTo(tag.value);
    }
631108
public static <T> boolean compareInstance(T t1, T t2) {
        if (t1 == t2) {
            return true;
        }
        if (t1 != null && t2 != null && t1.equals(t2)) {
            return true;
        }

        return false;
    }
1282823
public int compareTo(Object o) {
    int thisValue = this.value;
    int thatValue = ((ByteWritable)o).value;
    return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
  }
547406
public int compareTo(Object compareTo) throws ClassCastException {
		if (!(compareTo instanceof UUID)) {
			throw new ClassCastException();
		}
		return (Bytes.compareTo(rawBytes, ((UUID) compareTo).getRawBytes()));
	}
115944
public static <T> int compare(IntStream s1, IntStream s2)
    {
        return compare(s1, s2, null);
    }