org.javatuples
Class LabelValue<A,B>

Object
  extended by org.javatuples.Tuple
      extended by org.javatuples.LabelValue<A,B>
All Implemented Interfaces:
Serializable, Comparable<Tuple>, Iterable<Object>, IValueLabel<A>, IValueValue<B>

public final class LabelValue<A,B>
extends Tuple
implements IValueLabel<A>, IValueValue<B>

A tuple of two elements, with positions 0 and 1 renamed as "label" and "value", respectively.

Since:
1.0
Author:
Daniel Fernández
See Also:
Serialized Form

Constructor Summary
LabelValue(A label, B value)
           
 
Method Summary
static
<X> LabelValue<X,X>
fromArray(X[] array)
           Create tuple from array.
static
<X> LabelValue<X,X>
fromCollection(Collection<X> collection)
           
static
<X> LabelValue<X,X>
fromIterable(Iterable<X> iterable)
           
static
<X> LabelValue<X,X>
fromIterable(Iterable<X> iterable, int index)
           
 A getLabel()
           
 int getSize()
           Return the size of the tuple.
 B getValue()
           
<X> LabelValue<X,B>
setLabel(X label)
           
<Y> LabelValue<A,Y>
setValue(Y value)
           
static
<A,B> LabelValue<A,B>
with(A label, 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 Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LabelValue

public LabelValue(A label,
                  B value)
Method Detail

with

public static <A,B> LabelValue<A,B> with(A label,
                                         B value)

fromArray

public static <X> LabelValue<X,X> fromArray(X[] array)

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

public static <X> LabelValue<X,X> fromCollection(Collection<X> collection)

fromIterable

public static <X> LabelValue<X,X> fromIterable(Iterable<X> iterable)

fromIterable

public static <X> LabelValue<X,X> fromIterable(Iterable<X> iterable,
                                               int index)

getLabel

public A getLabel()
Specified by:
getLabel in interface IValueLabel<A>

getValue

public B getValue()
Specified by:
getValue in interface IValueValue<B>

getSize

public int getSize()
Description copied from class: Tuple

Return the size of the tuple.

Specified by:
getSize in class Tuple
Returns:
the size of the tuple.

setLabel

public <X> LabelValue<X,B> setLabel(X label)

setValue

public <Y> LabelValue<A,Y> setValue(Y value)


Copyright © 2012 The JAVATUPLES team. All Rights Reserved.