Class KeyComparator<T,C extends Comparable<? super C>>

java.lang.Object
org.eclipse.xtext.xbase.lib.internal.KeyComparator<T,C>
Type Parameters:
T - the type to compare
C - the type of the comparable key
All Implemented Interfaces:
Comparator<T>

@GwtCompatible public final class KeyComparator<T,C extends Comparable<? super C>> extends Object implements Comparator<T>
A comparator that compares objects by calling the supplied key function on them and then comparing the resulting keys. It is null-safe if the key's compareTo method is null-safe.
  • Constructor Details

    • KeyComparator

      public KeyComparator(Functions.Function1<? super T,C> keyFunction)
      Parameters:
      keyFunction - the key function to use for comparing objects. May not be null
  • Method Details