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
- See Also:
-
Field Summary
Fields -
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) private static <X> KeyValue<X, X> fromIterable(Iterable<X> iterable, int index, boolean exactSize) 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 Tuple
compareTo, contains, containsAll, containsAll, equals, getValue, hashCode, indexOf, iterator, lastIndexOf, toArray, toList, toStringMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
SIZE
private static final int SIZE- See Also:
-
key
-
value
-
-
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
-
fromIterable
-
getKey
-
getValue
- Specified by:
getValuein interfaceIValueValue<A>
-
getSize
-
setKey
-
setValue
-