Compare method.
@param o1 First field to compare
@param o2 Second field to compare
@return The lesser looking at order property
973168
@Override
    public int compare(Field o1, Field o2) {
        int i = order.indexOf(o1.getId());
        int j = order.indexOf(o2.getId());
        if(i==j) return 0;
        if(i==-1 && j >= 0) return 1;
        if(j==-1 && i >= 0) return -1;
        return i - j;
    }
1014955
@Override
    public int compareTo(final ColumnMapping o) {
        
        if(this.number == o.number) {
            return this.field.getName().compareTo(o.field.getName());
            
        } else {
            return Integer.compare(number, o.number);
        }
        
    }
841438
public static boolean isEqual(Object o1, Object o2) {
        return isEqual(str(o1), str(o2));
    }
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);
    }
919598
public int compare(final SnomedConcept o1, final SnomedConcept o2) {
        if (o1 == o2) return 0;
        if (o1 != null) {
            if (o2 == null) return 1;
            else return o1.candidatePreferred.compareTo(o2.candidatePreferred);
        }
        return -1;
    }
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);
    }
404759
@Override
    public int compareTo(Object o) {
        if (o instanceof ICpe) {
            ICpe otherObject = (ICpe) o;

            final int before = -1;
            final int equal = 0;
            final int after = 1;

            if (this == otherObject) {
                return equal;
            }
            int r = getPart().getAbbreviation().compareTo(otherObject.getPart().getAbbreviation());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getVendor().compareTo(otherObject.getVendor());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getProduct().compareTo(otherObject.getProduct());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = compareVersions(getVersion(), otherObject.getVersion());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getUpdate().compareTo(otherObject.getUpdate());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getEdition().compareTo(otherObject.getEdition());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getLanguage().compareTo(otherObject.getLanguage());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getSwEdition().compareTo(otherObject.getSwEdition());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getTargetSw().compareTo(otherObject.getTargetSw());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getTargetHw().compareTo(otherObject.getTargetHw());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            r = getOther().compareTo(otherObject.getOther());
            if (r < 0) {
                return before;
            } else if (r > 0) {
                return after;
            }
            return equal;
        }
        throw new RuntimeException("Unable to compare " + o.getClass().getCanonicalName());
    }
8059
private int compare(Object k1, Object k2) {
        return (mComparator==null ? ((Comparable)k1).compareTo(k2)
                : mComparator.compare(k1, k2));
    }
901341
public boolean equal(final Object o1,
                         Object o2) {
        if ( o1 == o2 ) {
            return true;
            
        }
        // o1 is a FactHandle, so just check their id's are the same
        if ( o1 instanceof FactHandle ) {
            return ((InternalFactHandle)o1).getId() == ((InternalFactHandle)o2).getId() ;
        }

        // o1 is an object, so unwrap o2 for comparison
        final InternalFactHandle handle = ((InternalFactHandle) o2);
        o2 = handle.getObject();
        return o1 == o2 || o2.equals( o1 );
    }
131310
final static boolean valEquals(final Object o1, final Object o2) {
    return (o1 == null ? o2 == null : o1.equals(o2));
  }
653447
public int compare(Performance o1, Performance o2) {
    int	result;
    double	p1;
    double	p2;

    if (o1.getEvaluation() != o2.getEvaluation())
      throw new IllegalArgumentException("Comparing different types of performances!");

    p1 = o1.getPerformance();
    p2 = o2.getPerformance();

    if (p1 < p2)
      result = -1;
    else if (p1 > p2)
      result = 1;
    else
      result = o1.getValues().compareTo(o2.getValues());

    // only correlation coefficient/accuracy/kappa obey to this order, for the
    // errors (and the combination of all three), the smaller the number the
    // better -> hence invert them
    if (getMetrics().invert(getEvaluation()))
      result = -result;

    return result;
  }
887711
public int compareTo(InternalFeature o) {
		if (null == o) {
			return -1; // avoid NPE, put null objects at the end
		}
		if (null != styleDefinition && null != o.getStyleInfo()) {
			if (styleDefinition.getIndex() > o.getStyleInfo().getIndex()) {
				return 1;
			}
			if (styleDefinition.getIndex() < o.getStyleInfo().getIndex()) {
				return -1;
			}
		}
		return 0;
	}
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);
            }
        }
    }
644800
public static boolean equalsValue(final Object o1, final Object o2) {
        if (o1 == null) {
            return o2 == null;
        }
        return o1.equals(o2);
    }
896954
@SuppressWarnings("checkstyle:ReturnCount")
  public static int compareBuff(final DirectBuffer o1, final DirectBuffer o2) {
    requireNonNull(o1);
    requireNonNull(o2);
    if (o1.equals(o2)) {
      return 0;
    }
    final int minLength = Math.min(o1.capacity(), o2.capacity());
    final int minWords = minLength / Long.BYTES;

    for (int i = 0; i < minWords * Long.BYTES; i += Long.BYTES) {
      final long lw = o1.getLong(i, BIG_ENDIAN);
      final long rw = o2.getLong(i, BIG_ENDIAN);
      final int diff = Long.compareUnsigned(lw, rw);
      if (diff != 0) {
        return diff;
      }
    }

    for (int i = minWords * Long.BYTES; i < minLength; i++) {
      final int lw = Byte.toUnsignedInt(o1.getByte(i));
      final int rw = Byte.toUnsignedInt(o2.getByte(i));
      final int result = Integer.compareUnsigned(lw, rw);
      if (result != 0) {
        return result;
      }
    }

    return o1.capacity() - o2.capacity();
  }
1363358
public static final <T> int compare(T o1, T o2, Comparator<T> comp)
    {
        if (comp != null)
        {
            return comp.compare(o1, o2);
        }
        else
        {
            return ((Comparable<T>)o1).compareTo(o2);
        }
    }
1063786
private static int comparePackageClass(Class<?> o1, Class<?> o2) {
    return o1.getPackage() == o2.getPackage() ? //
        o1.getCanonicalName().compareTo(o2.getCanonicalName()) //
        : o1.getPackage() == null ? -1 : o2.getPackage() == null ? +1 //
            : o1.getPackage().getName().compareTo(o2.getPackage().getName());
  }