Class DelegatingComparator

  • All Implemented Interfaces:
    Comparator<Object>

    public class DelegatingComparator
    extends Object
    implements Comparator<Object>
    The delegating comparator extracts the field value of the specified field name or path and uses the specified comparator for sorting.
    Author:
    Christian Bremer
    • Constructor Detail

      • DelegatingComparator

        public DelegatingComparator​(String field,
                                    Comparator<?> comparator)
        Instantiates a new delegating comparator.
        Parameters:
        field - the field name or path (can be null)
        comparator - the comparator to compare the value of the field
      • DelegatingComparator

        public DelegatingComparator​(String field,
                                    ValueExtractor valueExtractor,
                                    Comparator<?> comparator)
        Instantiates a new delegating comparator.
        Parameters:
        field - the field name or path (can be null)
        valueExtractor - a custom value extractor (can be null)
        comparator - the comparator to compare the value of the field