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 extends Object implements SerializableComparator {
013    
014        /**
015         * Compare the two objects assuming they are both {@link java.lang.Comparable comparable}.
016         *
017         * @override Never
018         */
019        public final int compare(Object o1, Object o2) {
020            return ((Comparable)o1).compareTo(o2);
021        }
022    }