Class AbstractComparator<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int AFTER  
      protected static int BEFORE  
      protected static int EQUAL  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(T instance1, T instance2)  
      protected abstract int compareInstances​(T instance1, T instance2)
      Implement method to perform the comparison.
      protected int compareValues​(double double1, double double2)  
      protected int compareValues​(int int1, int int2)  
      protected int compareValues​(long long1, long long2)  
      protected int compareValues​(java.lang.String string1, java.lang.String string2, boolean caseSensitive)  
      protected int compareValues​(java.util.Date date1, java.util.Date date2)  
      protected boolean instanceEquals​(java.lang.Object object1, java.lang.Object object2)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • AbstractComparator

        public AbstractComparator()
    • Method Detail

      • compare

        public int compare​(T instance1,
                           T instance2)
        Specified by:
        compare in interface java.util.Comparator<T>
      • compareInstances

        protected abstract int compareInstances​(T instance1,
                                                T instance2)
        Implement method to perform the comparison. The instances passed are different and neither is null.
        Parameters:
        instance1 - first instance
        instance2 - second instance
        Returns:
        return one of BEFORE, EQUAL, or AFTER.
      • instanceEquals

        protected boolean instanceEquals​(java.lang.Object object1,
                                         java.lang.Object object2)
      • compareValues

        protected int compareValues​(int int1,
                                    int int2)
      • compareValues

        protected int compareValues​(long long1,
                                    long long2)
      • compareValues

        protected int compareValues​(double double1,
                                    double double2)
      • compareValues

        protected int compareValues​(java.util.Date date1,
                                    java.util.Date date2)
      • compareValues

        protected int compareValues​(java.lang.String string1,
                                    java.lang.String string2,
                                    boolean caseSensitive)