com.softicar.platform.common.container.pair.ComparablePair Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.container.pair;
/**
* The default implementation of {@link IComparablePair}.
*
* @author Oliver Richers
*/
public class ComparablePair, B extends Comparable> extends Pair implements IComparablePair {
public ComparablePair(A first, B second) {
super(first, second);
}
@Override
public int compareTo(IComparablePair other) {
int cmp = getFirst().compareTo(other.getFirst());
return cmp != 0? cmp : getSecond().compareTo(other.getSecond());
}
}