Packagesystem.comparators
Classpublic class ComparableComparator
InheritanceComparableComparator Inheritance Object
Implements Comparator

A Comparator that compares object if one of them is a Comparable object.



Public Methods
 MethodDefined By
  
Creates a new ComparableComparator instance.
ComparableComparator
  
compare(o1:*, o2:*, options:* = null):int
Returns an integer value to compare two objects in parameters.
ComparableComparator
Constructor Detail
ComparableComparator()Constructor
public function ComparableComparator()

Creates a new ComparableComparator instance. This constructor whose use should be avoided.

Method Detail
compare()method
public function compare(o1:*, o2:*, options:* = null):int

Returns an integer value to compare two objects in parameters.

Parameters

o1:* — the first object to compare.
 
o2:* — the second object to compare.
 
options:* (default = null)

Returns
int

  • -1 if o1 is "lower" than (less than, before, etc.) o2 ;
  • 1 if o1 is "higher" than (greater than, after, etc.) o2 ;
  • 0 if o1 and o2 are equal.

  • Throws
    ArgumentError — it the o1 object is not a IComparable object.