@Override
    public int compare(T leftBean, T rightBean) {
        if (leftBean == rightBean) {
            return 0; // Reference to the same object should always result in '0'
        } else if (leftBean == null) {
            return -1; // Whenever the reference varies and left is null, right is not null
        } else if (rightBean == null) {
            return 1; // Whenever the reference varies and right is null, left is not null
        } else if (leftBean.equals(rightBean)) {
            return 0; // Equal beans should always result in '0'
        }
        return comparePathValues(leftBean, rightBean);
    }
Compares two beans based on the values at a specific path.

@author Jeroen van Schagen
@author tiwe

@param <T> type of the path root
@param <V> type of value being matched
querydsl-collections/src/main/java/com/querydsl/collections/PathComparator.java