javafixes.object.SmartComparable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javafixes Show documentation
Show all versions of javafixes Show documentation
Things I would like to have in Java by default
package javafixes.object;
public interface SmartComparable extends Comparable {
default boolean isBefore(T other) {
return this.compareTo(other) < 0;
}
default boolean isBeforeOrEqual(T other) {
return this.compareTo(other) <= 0;
}
default boolean isAfter(T other) {
return this.compareTo(other) > 0;
}
default boolean isAfterOrEqual(T other) {
return this.compareTo(other) >= 0;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy