public class Comp
extends java.lang.Object
lt, lte, gt, gte, which parallel
the equals method. This is similar to Ruby, where defining the <=>
method (the "spaceship" method) results in the equivalent generation of <,
<=, etc.| Constructor and Description |
|---|
Comp() |
| Modifier and Type | Method and Description |
|---|---|
static <Type extends java.lang.Comparable<Type>> |
compare(Type x,
Type y)
Compares the two objects, including testing for null.
|
static <Type extends java.lang.Comparable<Type>> |
greaterThan(Type x,
Type y)
Returns whether x is greater than y.
|
static <Type extends java.lang.Comparable<Type>> |
gt(Type x,
Type y)
Returns whether x is greater than y.
|
static <Type extends java.lang.Comparable<Type>> |
gte(Type x,
Type y)
Returns whether x is greater than or equal to y.
|
static <Type extends java.lang.Comparable<Type>> |
lessThan(Type x,
Type y)
Returns whether x is less than y.
|
static <Type extends java.lang.Comparable<Type>> |
lt(Type x,
Type y)
Returns whether x is less than y.
|
static <Type extends java.lang.Comparable<Type>> |
lte(Type x,
Type y)
Returns whether x is less than or equal to y.
|
public static <Type extends java.lang.Comparable<Type>> int compare(Type x,
Type y)
Type - the type, which is Comparablex - the first valuey - the second valuepublic static <Type extends java.lang.Comparable<Type>> boolean lessThan(Type x,
Type y)
Type - the type, which is Comparablex - the first valuey - the second valuepublic static <Type extends java.lang.Comparable<Type>> boolean lt(Type x,
Type y)
Type - the type, which is Comparablex - the first valuey - the second valuepublic static <Type extends java.lang.Comparable<Type>> boolean lte(Type x,
Type y)
Type - the type, which is Comparablex - the first valuey - the second valuepublic static <Type extends java.lang.Comparable<Type>> boolean greaterThan(Type x,
Type y)
Type - the type, which is Comparablex - the first valuey - the second valuepublic static <Type extends java.lang.Comparable<Type>> boolean gt(Type x,
Type y)
Type - the type, which is Comparablex - the first valuey - the second valuepublic static <Type extends java.lang.Comparable<Type>> boolean gte(Type x,
Type y)
Type - the type, which is Comparablex - the first valuey - the second value