Package io.jenetics.util
Class Ordered<T>
- java.lang.Object
-
- io.jenetics.util.Ordered<T>
-
- Type Parameters:
T
- the type of the wrapped object
- All Implemented Interfaces:
Comparable<Ordered<T>>
,Supplier<T>
public final class Ordered<T> extends Object implements Comparable<Ordered<T>>, Supplier<T>
Object wrapper, which makes the wrapped valueComparable
, by defining a separateComparator
.- Since:
- 6.3
- Version:
- 6.3
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Ordered<T> other)
T
get()
Return the wrapped value.static <T> Ordered<T>
of(T value, Comparator<? super T> comparator)
Make the givenvalue
comparable, by using the givencomparator
.
-
-
-
Method Detail
-
compareTo
public int compareTo(Ordered<T> other)
- Specified by:
compareTo
in interfaceComparable<T>
-
of
public static <T> Ordered<T> of(T value, Comparator<? super T> comparator)
Make the givenvalue
comparable, by using the givencomparator
.- Type Parameters:
T
- the type of the wrapped object- Parameters:
value
- the wrapped object, may benull
comparator
- the comparator used for comparing two value objects- Returns:
- a new ordered object
- Throws:
NullPointerException
- if the givencomparator
isnull
-
-