Class Pair<A,B>
java.lang.Object
org.jlab.coda.emu.support.data.tuple.Tuple
org.jlab.coda.emu.support.data.tuple.Pair<A,B>
- All Implemented Interfaces:
Serializable,Comparable<Tuple>,Iterable<Object>,IValue0<A>,IValue1<B>
A tuple of two elements.
- Since:
- 1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(X0 value0) addAt0(X0 value0) addAt1(X0 value0) addAt2(X0 value0) static <X> Pair<X,X> fromArray(X[] array) Create tuple from array.static <X> Pair<X,X> fromCollection(Collection<X> collection) Create tuple from collection.static <X> Pair<X,X> fromIterable(Iterable<X> iterable) Create tuple from iterable.static <X> Pair<X,X> fromIterable(Iterable<X> iterable, int index) Create tuple from iterable, starting from the specified index.intgetSize()Return the size of the tuple.setAt0(X value) setAt1(X value) static <A,B> Pair<A, B> with(A value0, B value1) Methods inherited from class org.jlab.coda.emu.support.data.tuple.Tuple
compareTo, contains, containsAll, containsAll, equals, getValue, hashCode, indexOf, iterator, lastIndexOf, toArray, toList, toStringMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Pair
-
-
Method Details
-
with
-
fromArray
Create tuple from array. Array has to have exactly two elements.
- Type Parameters:
X- the array component type- Parameters:
array- the array to be converted to a tuple- Returns:
- the tuple
-
fromCollection
Create tuple from collection. Collection has to have exactly two elements.
- Type Parameters:
X- the collection component type- Parameters:
collection- the collection to be converted to a tuple- Returns:
- the tuple
-
fromIterable
Create tuple from iterable. Iterable has to have exactly two elements.
- Type Parameters:
X- the iterable component type- Parameters:
iterable- the iterable to be converted to a tuple- Returns:
- the tuple
-
fromIterable
Create tuple from iterable, starting from the specified index. Iterable can have more (or less) elements than the tuple to be created.
- Type Parameters:
X- the iterable component type- Parameters:
iterable- the iterable to be converted to a tuple- Returns:
- the tuple
-
getValue0
-
getValue1
-
getSize
public int getSize()Description copied from class:TupleReturn the size of the tuple.
-
addAt0
-
addAt1
-
addAt2
-
add
-
setAt0
-
setAt1
-