Class ComparableSingle<T1 extends Comparable<? super T1>>
- java.lang.Object
-
- dk.cloudcreate.essentials.shared.functional.tuple.comparable.ComparableSingle<T1>
-
- Type Parameters:
T1- the first element type
- All Implemented Interfaces:
ComparableTuple<ComparableSingle<T1>>,Serializable,Comparable<ComparableSingle<T1>>
public class ComparableSingle<T1 extends Comparable<? super T1>> extends Object implements ComparableTuple<ComparableSingle<T1>>
Represents aComparableTuplewith one element.
Note:ComparableSinglesupportsequals(Object)comparison using subclasses, e.g.:public class Option extends ComparableSingle<String> { public Option(String optionalValue) { super(optionalValue); } }- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ComparableSingle(T1 t1)Create a newComparableTuplewith 1 element
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T1_1()Returns the first element in this tupleintarity()Number of arguments/elements in the TupleintcompareTo(ComparableSingle<T1> o)booleanequals(Object o)inthashCode()<R1 extends Comparable<? super R1>>
ComparableSingle<R1>map(Function<? super T1,? extends R1> mappingFunction)Maps the element of thisComparableSingleusing the mapping functionList<?>toList()Convert the Tuple to a listStringtoString()
-
-
-
Field Detail
-
_1
public final T1 extends Comparable<? super T1> _1
The first element in this tuple
-
-
Constructor Detail
-
ComparableSingle
public ComparableSingle(T1 t1)
Create a newComparableTuplewith 1 element- Parameters:
t1- the first element
-
-
Method Detail
-
arity
public int arity()
Description copied from interface:ComparableTupleNumber of arguments/elements in the Tuple- Specified by:
arityin interfaceComparableTuple<T1 extends Comparable<? super T1>>- Returns:
- Number of arguments/elements in the Tuple
-
toList
public List<?> toList()
Description copied from interface:ComparableTupleConvert the Tuple to a list- Specified by:
toListin interfaceComparableTuple<T1 extends Comparable<? super T1>>- Returns:
- list of all Tuple elements
-
_1
public T1 _1()
Returns the first element in this tuple- Returns:
- the first element in this tuple
-
compareTo
public int compareTo(ComparableSingle<T1> o)
- Specified by:
compareToin interfaceComparable<T1 extends Comparable<? super T1>>
-
map
public <R1 extends Comparable<? super R1>> ComparableSingle<R1> map(Function<? super T1,? extends R1> mappingFunction)
Maps the element of thisComparableSingleusing the mapping function- Type Parameters:
R1- result type for the mapping function- Parameters:
mappingFunction- the mapping function- Returns:
- a new
ComparableSinglewith the result of applying the mapping function to thisComparableSingle
-
-