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
- 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()
int
getSize()
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, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.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:
getValue
in interfaceIValueValue<A>
-
getSize
public int getSize()Description copied from class:Tuple
Return the size of the tuple.
-
setKey
-
setValue
-