class NaturalOrderComparator implements Comparator<OBJECT> {

	@Pure
	@Override
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public int compare(OBJECT o1, OBJECT o2) {
		if (o1 == o2) {
			return 0;
		}
		if (o1 == null) {
			return Integer.MIN_VALUE;
		}
		if (o2 == null) {
			return Integer.MAX_VALUE;
		}
		try {
			return ((Comparable) o1).compareTo(o2);
		} catch (Throwable exception) {
			//
		}
		try {
			return -((Comparable) o2).compareTo(o1);
		} catch (Throwable exception) {
			//
		}
		throw new UnsupportedNaturalOrderException(o1);
	}

}