Package dk.cloudcreate.essentials.shared.functional.tuple
-
Interface Summary Interface Description Tuple<CONCRETE_TUPLE extends Tuple<CONCRETE_TUPLE>> Base interface for allTuple's.
ATupleis an immutable object that can contain the following (supported) number of elements: Number of element in TupleConcreteTupletypeFactory method 0EmptyTuple.empty()1SingleTuple.of(Object)2PairTuple.of(Object, Object)3TripleTuple.of(Object, Object, Object)
Note:Tuple(and its subclasses) supportsObject.equals(Object)comparison using subclasses for the different subclasses -
Class Summary Class Description Either<T1,T2> Represents aTuplewith two potential elements, but where only one element can have a value at a time
This is used to represent a choice type that can have two different values, but only one value at a time.
The value can either beEither._1()OREither._2()
UseEither(Object, Object)orEither.of_1(Object)/Either.of_2(Object)to create a newEitherinstance
UseEither.is_1()orEither.is_2()to check which value is non-null andEither._1()orEither._2()to get the value of the element.
Conditional logic can be applied usingEither.ifIs_1(Consumer)orEither.ifIs_2(Consumer)Empty Represents aTuplewith zero elementsPair<T1,T2> Represents aTuplewith two elements.
Note:PairsupportsPair.equals(Object)comparison using subclasses, e.g.:Single<T1> Represents aTuplewith one element.
Note:SinglesupportsSingle.equals(Object)comparison using subclasses, e.g.:Triple<T1,T2,T3> Represents aTuplewith three elements.
Note:TriplesupportsTriple.equals(Object)comparison using subclasses, e.g.: