Package 

Class SortComparator


  • 
    public final class SortComparator<T extends Object, V extends Comparable<V>>
    
                        

    A comparator that can sort model instances by extracting comparable values.

    This class provides the foundation for local sorting operations by wrapping a lambda that extracts comparable values from model instances. It handles the comparison logic and direction handling internally.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Function1<T, V> value
    • Constructor Summary

      Constructors 
      Constructor Description
      SortComparator(Function1<T, V> value)
    • Method Summary

      Modifier and Type Method Description
      final Function1<T, V> getValue()
      final Integer compare(T lhs, T rhs, SortDirection direction) Compares two model instances using the extracted values and sort direction.
      final AnySortComparator<T> toAny() Converts this comparator to a type-erased version.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SortComparator

        SortComparator(Function1<T, V> value)
    • Method Detail

      • compare

         final Integer compare(T lhs, T rhs, SortDirection direction)

        Compares two model instances using the extracted values and sort direction.

        Parameters:
        lhs - The first model instance to compare
        rhs - The second model instance to compare
        direction - The direction of the sort