Package org.javatuples
Class KeyValue<A,B>
java.lang.Object
org.javatuples.Tuple
org.javatuples.KeyValue<A,B>
- All Implemented Interfaces:
Serializable,Comparable<Tuple>,Iterable<Object>,IValueKey<A>,IValueValue<B>
A tuple of two elements, with positions 0 and 1 renamed as "key" and "value", respectively.
- Since:
- 1.0
- Author:
- Daniel Fernández
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <X> KeyValue<X, X> fromArray(X[] array) Create tuple from array.static <X> KeyValue<X, X> fromCollection(Collection<X> collection) static <X> KeyValue<X, X> fromIterable(Iterable<X> iterable) static <X> KeyValue<X, X> fromIterable(Iterable<X> iterable, int index) getKey()intgetSize()Return the size of the tuple.getValue()setKey(X key) setValue(Y value) static <A,B> KeyValue <A, B> with(A key, B value) Methods inherited from class org.javatuples.Tuple
compareTo, contains, containsAll, containsAll, equals, getValue, hashCode, indexOf, iterator, lastIndexOf, toArray, toList, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
KeyValue
-
-
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
-
fromIterable
-
fromIterable
-
getKey
-
getValue
- Specified by:
getValuein interfaceIValueValue<A>
-
getSize
public int getSize()Description copied from class:TupleReturn the size of the tuple.
-
setKey
-
setValue
-