Code example for Comparator

Methods: compare

0
 
    @Override 
    public int compare(E o1, E o2) {
        // Comparator should always be consistent with equals. 
        if (areEqual(o1, o2)) return 0;
        return comparator.compare(o1, o2) < 0 ? -1 : 1;
    }    
}