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 a
Note:
ComparableTuple with one element.Note:
ComparableSingle supports equals(Object) comparison using subclasses, e.g.:
public class Option extends ComparableSingle<String> {
public Option(String optionalValue) {
super(optionalValue);
}
}
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_1()Returns the first element in this tupleintarity()Number of arguments/elements in the TupleintbooleaninthashCode()<R1 extends Comparable<? super R1>>
ComparableSingle<R1>Maps the element of thisComparableSingleusing the mapping functionList<?>toList()Convert the Tuple to a listtoString()
-
Field Details
-
_1
The first element in this tuple
-
-
Constructor Details
-
ComparableSingle
Create a newComparableTuplewith 1 element- Parameters:
t1- the first element
-
-
Method Details
-
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
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
Returns the first element in this tuple- Returns:
- the first element in this tuple
-
equals
-
hashCode
public int hashCode() -
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
-
toString
-