public final class KeyValue<A,B> extends Tuple implements IValueKey<A>, IValueValue<B>
A tuple of two elements, with positions 0 and 1 renamed as "key" and "value", respectively.
| Modifier and Type | Method and Description |
|---|---|
static <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) |
A |
getKey() |
int |
getSize()
Return the size of the tuple.
|
B |
getValue() |
<X> KeyValue<X,B> |
setKey(X key) |
<Y> KeyValue<A,Y> |
setValue(Y value) |
static <A,B> KeyValue<A,B> |
with(A key,
B value) |
compareTo, contains, containsAll, containsAll, equals, getValue, hashCode, indexOf, iterator, lastIndexOf, toArray, toList, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static <A,B> KeyValue<A,B> with(A key, B value)
public static <X> KeyValue<X,X> fromArray(X[] array)
Create tuple from array. Array has to have exactly two elements.
X - the array component typearray - the array to be converted to a tuplepublic static <X> KeyValue<X,X> fromCollection(Collection<X> collection)
public B getValue()
getValue in interface IValueValue<B>public int getSize()
TupleReturn the size of the tuple.
Copyright © 2016. All rights reserved.