接口 TypeComparator

所有已知实现类:
StandardTypeComparator

public interface TypeComparator
Instances of a type comparator should be able to compare pairs of objects for equality. The specification of the return value is the same as for Comparable.
从以下版本开始:
4.0
作者:
Andy Clement
另请参阅:
  • 方法概要

    修饰符和类型
    方法
    说明
    boolean
    canCompare(Object firstObject, Object secondObject)
    Return true if the comparator can compare these two objects.
    int
    compare(Object firstObject, Object secondObject)
    Compare two given objects.
  • 方法详细资料

    • canCompare

      boolean canCompare(@Nullable Object firstObject, @Nullable Object secondObject)
      Return true if the comparator can compare these two objects.
      参数:
      firstObject - the first object
      secondObject - the second object
      返回:
      true if the comparator can compare these objects
    • compare

      int compare(@Nullable Object firstObject, @Nullable Object secondObject) throws EvaluationException
      Compare two given objects.
      参数:
      firstObject - the first object
      secondObject - the second object
      返回:
      0 if they are equal, a negative integer if the first is smaller than the second, or a positive integer if the first is larger than the second
      抛出:
      EvaluationException - if a problem occurs during comparison (or if they are not comparable in the first place)
      另请参阅: