Class FunctionComparator<T,​V>

  • All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<T>, SerializableComparator<T>

    public class FunctionComparator<T,​V>
    extends java.lang.Object
    implements SerializableComparator<T>
    Simple Comparator that uses a Function to select a value from the underlying object and compare it against a known value to determine ordering.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FunctionComparator​(Function<? super T,​? extends V> function, java.util.Comparator<V> comparator)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(T o1, T o2)  
      • 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
    • Field Detail

      • function

        private final Function<? super T,​? extends V> function
      • comparator

        private final java.util.Comparator<V> comparator
    • Constructor Detail

      • FunctionComparator

        public FunctionComparator​(Function<? super T,​? extends V> function,
                                  java.util.Comparator<V> comparator)
    • Method Detail

      • compare

        public int compare​(T o1,
                           T o2)
        Specified by:
        compare in interface java.util.Comparator<T>