Class DefaultComparator

java.lang.Object
rs.baselib.util.DefaultComparator
All Implemented Interfaces:
java.util.Comparator<java.lang.Object>

public class DefaultComparator
extends java.lang.Object
implements java.util.Comparator<java.lang.Object>
Default comparator for objects. The comparator compares NULL-safe and evaluates interfaces that help when comparing, such as Comparable, IDisplayProvider and IDisplayable. If none of these interfaces are implemented then the Object.toString() values will be ignore with String.compareToIgnoreCase(String).
Author:
ralph
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.util.Comparator<java.lang.Object> INSTANCE
    A default final instance for fast usage
  • Constructor Summary

    Constructors 
    Constructor Description
    DefaultComparator()
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    int compare​(java.lang.Object o1, java.lang.Object o2)

    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
  • Field Details

    • INSTANCE

      public static final java.util.Comparator<java.lang.Object> INSTANCE
      A default final instance for fast usage
  • Constructor Details

  • Method Details

    • compare

      public int compare​(java.lang.Object o1, java.lang.Object o2)
      Specified by:
      compare in interface java.util.Comparator<java.lang.Object>