Class AttributeComparator

java.lang.Object
fr.paris.lutece.util.sort.AttributeComparator
All Implemented Interfaces:
Serializable, Comparator<Object>

public class AttributeComparator extends Object implements Comparator<Object>, Serializable
This class provide Attribute Comparator
See Also:
  • Constructor Details

    • AttributeComparator

      public AttributeComparator(String strSortedAttribute, boolean bIsASC)
      Constructor
      Parameters:
      strSortedAttribute - the name of the attribute on which the sort will be made
      bIsASC - true for the ASC order, false for the DESC order
    • AttributeComparator

      public AttributeComparator(String strSortedAttribute)
      Constructor
      Parameters:
      strSortedAttribute - the name of the attribute on which the sort will be made
  • Method Details

    • compare

      public int compare(Object o1, Object o2)
      Compare two objects o1 and o2.
      Specified by:
      compare in interface Comparator<Object>
      Parameters:
      o1 - Object
      o2 - Object
      Returns:
      < 0 if o1 is before o2 in the alphabetical order 0 if o1 equals o2 > 0 if o1 is after o2