001    package util;
002    
003    /**
004     * A comparator that compares Objects using their natural order.
005     *
006     * <p>This is a convenience facade for the {@link java.lang.Comparable} interface.</p>
007     *
008     * @author Steffen Zschaler
009     * @version 2.0 27/07/1999
010     * @since v2.0
011     */
012    public final class NaturalComparator<T extends Comparable<Object>> implements SerializableComparator<T> {
013    
014        /**
015             * ID for serialization.
016             */
017            private static final long serialVersionUID = -8841200095132848862L;
018    
019            /**
020         * Compare the two objects assuming they are both {@link java.lang.Comparable comparable}.
021         *
022         * @override Never
023         */
024        public final int compare(T o1, T o2) {
025            return o1.compareTo(o2);
026        }
027    }