Class IterableComparator<T>

  • All Implemented Interfaces:
    java.util.Comparator<java.lang.Iterable<? extends T>>

    public final class IterableComparator<T>
    extends DelegatingComparator<java.lang.Iterable<? extends T>>
    Comparator for Iterables. Elements are compared by the given Comparator of Optionals. The delegate will receive absent Optionals when the shorter Iterable has run out of elements.

    Examples

    With new OptionalComparator(naturalOrder) as the delegate

     [] == []
     [1, 2, 3] == [1, 2, 3]
     [1, 2, 3] < [1, 2, 3, 4]
     [1, 2, 3] < [1, 2, 4]
     [1, 2, 3] < [1, 3]
     
    • Constructor Summary

      Constructors 
      Constructor Description
      IterableComparator​(java.util.Comparator<? super Optional<? extends T>> delegate)  
    • Method Summary

      • 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

      • IterableComparator

        public IterableComparator​(java.util.Comparator<? super Optional<? extends T>> delegate)