The method used to sort the metrics array.
@param o1 the first element
@param o2 the second element
@return the comparison
15289
public int compare(Object o1, Object o2) {
        int m1 = ((int[])o1)[0];
        int m2 = ((int[])o2)[0];
        if (m1 < m2)
            return -1;
        if (m1 == m2)
            return 0;
        return 1;
    }
739999
@Override
  public int compare(S solution1, S solution2) {
    int result = rankComparator.compare(solution1, solution2) ;
    if (result == 0) {
      result = crowdingDistanceComparator.compare(solution1, solution2);
    }

    return result;
  }
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;
	}
830588
public static final <T extends Comparable<T>> int comparator(T val1, T val2) {
		if(val1 == null) {
			return val2 == null? 0 : -1;
		} else {
			return val2 == null? 1 : val1.compareTo(val2);
		}
	}
1216696
@Override
    public int compare(String o1, String o2) {

        if (o1.equals(o2)) {
            return 0;
        }

        String prefix = Strings.commonPrefix(o1, o2);
        if (prefix.length() == 0) {
            // No common prefix
            return o1.compareTo(o2);
        }

        if (o1.length() == prefix.length()) {
            return -1;
        }

        return o1.compareTo(o2);

    }
828187
public static final <T extends Comparable<T>> int comparator(T val1, T def1, T val2, T def2) {
		return comparator(val1 == null? def1 : val1, val2 == null? def2 : val2);
		// return (val1 == null? def1 : val1).compareTo(val2 == null? def2 : val2);
	}
738910
public static <T> int compare(Stream<T> s1, Stream<T> s2, Comparator<T> comp)
    {
        Iterator<T> os1 = s1.iterator();
        Iterator<T> os2 = s2.iterator();
        Comparable<T> comparable = null;
        while (os1.hasNext() && os2.hasNext())
        {
            T n1 = os1.next();
            T n2 = os2.next();
            int c;
            if (comp == null)
            {
                comparable = (Comparable<T>) n1;
                c = comparable.compareTo(n2);
            }
            else
            {
                c = comp.compare(n1, n2);
            }
            if (c != 0)
            {
                return c;
            }
        }
        boolean hn1 = os1.hasNext();
        boolean hn2 = os2.hasNext();
        if (hn1 == hn2)
        {
            return 0;
        }
        if (hn1)
        {
            return 1;
        }
        else
        {
            return -1;
        }
    }
745792
public int compareTo(final OMVRBTreeEntry<K, V> o) {
    if (o == null)
      return 1;
    if (o == this)
      return 0;
    if (getSize() == 0)
      return -1;
    if (o.getSize() == 0)
      return 1;
    if (tree.comparator != null)
      return tree.comparator.compare(getFirstKey(), o.getFirstKey());

    return ((Comparable<K>) getFirstKey()).compareTo(o.getFirstKey());
  }
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());
      };
   }
568706
@Override
    public final int compare(T o1, T o2){
        if(o1==o2)
            return 0;
        else if(o1==null)
            return -1;
        else if(o2==null)
            return 1;
        else
            return _compare(o1, o2);
    }
1102079
@Override
    public int compare(
        ChronoInterval<T> o1,
        ChronoInterval<T> o2
    ) {

        Boundary<T> bs1 = o1.getStart();
        Boundary<T> bs2 = o2.getStart();

        if (bs1.isInfinite()) {
            if (bs2.isInfinite()) {
                return this.compareEnd(o1, o2);
            } else {
                return -1;
            }
        } else if (bs2.isInfinite()) {
            return 1;
        }

        T start1 = bs1.getTemporal();
        T start2 = bs2.getTemporal();

        if (bs1.isOpen()) {
            start1 = this.axis.stepForward(start1);
        }
        if (bs2.isOpen()) {
            start2 = this.axis.stepForward(start2);
        }

        // open max condition (rare edge case)
        if (start1 == null) {
            if (start2 == null) {
                return 0;
            } else {
                return 1;
            }
        } else if (start2 == null) {
            return -1;
        }

        int delta = this.axis.compare(start1, start2);

        if (delta == 0) {
            delta = this.compareEnd(o1, o2);
        }

        return delta;

    }
455899
@Override
    public int compare(String o1, String o2) {
        if (C_ELEMENT_SYMBOL.equals(o1)) {
            if (C_ELEMENT_SYMBOL.equals(o2)) {
                return 0;
            } else {
                return -1;
            }
        } else if (H_ELEMENT_SYMBOL.equals(o1)) {
            if (C_ELEMENT_SYMBOL.equals(o2)) {
                return 1;
            } else if (H_ELEMENT_SYMBOL.equals(o2)) {
                return 0;
            } else {
                return -1;
            }
        } else {
            if (C_ELEMENT_SYMBOL.equals(o2) || H_ELEMENT_SYMBOL.equals(o2)) {
                return 1;
            } else {
                return ((String) o1).compareTo((String) o2);
            }
        }
    }
373050
public static boolean areEqual(Object o1, Object o2) {
        return
            !o1.getClass().isArray() ? o1.equals(o2) :
                o1.getClass() == boolean[].class ? Arrays.equals((boolean[]) o1, (boolean[]) o2) :
                    o1.getClass() == byte[].class ? Arrays.equals((byte[]) o1, (byte[]) o2) :
                        o1.getClass() == char[].class ? Arrays.equals((char[]) o1, (char[]) o2) :
                            o1.getClass() == double[].class ? Arrays.equals(
                                (double[]) o1,
                                (double[]) o2
                            ) :
                                o1.getClass() == float[].class ? Arrays.equals(
                                    (float[]) o1,
                                    (float[]) o2
                                ) :
                                    o1.getClass() == int[].class ? Arrays.equals(
                                        (int[]) o1,
                                        (int[]) o2
                                    ) :
                                        o1.getClass() == long[].class ? Arrays.equals(
                                            (long[]) o1,
                                            (long[]) o2
                                        ) :
                                            o1.getClass() == short[].class ? Arrays.equals(
                                                (short[]) o1,
                                                (short[]) o2
                                            ) :
                                                Arrays.equals(
                                                    (Object[]) o1,
                                                    (Object[]) o2
                                                );
    }
281773
public int compareTo(CandidateField o) {
		if (o == null) {
			return 1;
		}
		
		int myWeight = this.weight == null ? 0 : this.weight.toInteger();
		int otherWeight = o.getWeight() == null ? 0 : o.getWeight().toInteger();
		
		if(myWeight > otherWeight) {
			return 1;
		}
		if(myWeight < otherWeight) {
			return -1;
		}
		return 0;
	}
1062662
private boolean isEqual(Object o1, Object o2)
    {
        // Both null - they are equal
        if (o1 == null && o2 == null)
        {
            return true;
        }
        // One is null and the other isn't - they are not equal
        if ((o1 == null && o2 != null) || (o1 != null && o2 == null))
        {
            return false;
        }

        // Otherwise fight it out amongst themselves
        return o1.equals(o2);
    }
696160
public Comparator<T> thenComparing(final java.util.Comparator<? super T> other) {
            final Comparator<T> me = this;
            return new Comparator<T>() {
                @Override
                public int compare(T o1, T o2) {
                    int ret = (me.compare(o1, o2));
                    return (0 == ret) ? other.compare(o1, o2) : ret;
                }
            };
        }
311400
@SuppressWarnings("unchecked")
    private static <T extends Comparable<T>> int compare(T o1, T o2) {
        if (o1 instanceof PMessage && o2 instanceof PMessage) {
            return compareMessages((PMessage) o1, (PMessage) o2);
        }
        return o1.compareTo(o2);
    }