F - defines the first type of the tuple. The supplied class must implement ComparableS - defines the second type of the tuplepublic class ComparableTuple<F extends Comparable<F>,S> extends Tuple<F,S> implements Comparable<ComparableTuple<F,S>>
Subclasses Tuple to implement Comparable based on the key, that is the first element of the tuple.
Tuple,
Comparable| Modifier | Constructor and Description |
|---|---|
protected |
ComparableTuple(F first,
S second) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(ComparableTuple<F,S> o) |
static <F extends Comparable<F>,S> |
create(F first)
Creates a new tuple by only specifying the first value of the tuple.
|
static <F extends Comparable<F>,S> |
create(F first,
S second)
Creates a new tuple with the given values.
|
static <F extends Comparable<F>,S> |
createTuple()
Creates a new tuple without any values.
|
boolean |
equals(Object obj) |
static <K extends Comparable<K>,V> |
fromComparableMap(Map<K,V> map)
Converts a map into a list of tuples.
|
int |
hashCode() |
@Nonnull public static <F extends Comparable<F>,S> ComparableTuple<F,S> createTuple()
F - the type for the first valueS - the type for the second value@Nonnull public static <F extends Comparable<F>,S> ComparableTuple<F,S> create(@Nullable F first)
The second value will remain null.
F - the type for the first valueS - the type for the second valuefirst - defines the first value of the tuple@Nonnull public static <F extends Comparable<F>,S> ComparableTuple<F,S> create(@Nullable F first, @Nullable S second)
F - the type for the first valueS - the type for the second valuefirst - defines the first value of the tuplesecond - defines the second value of the tuplepublic static <K extends Comparable<K>,V> List<ComparableTuple<K,V>> fromComparableMap(@Nonnull Map<K,V> map)
K - the key type of the map and therefore the type of the first component of the tuplesV - the value type of the map and therefore the type of the second component of the tuplesmap - the map to be convertedpublic int compareTo(ComparableTuple<F,S> o)
compareTo in interface Comparable<ComparableTuple<F extends Comparable<F>,S>>public boolean equals(Object obj)
Copyright © 2018. All rights reserved.