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

    private static final long serialVersionUID = 5055574980300695706L;

    private static final int SIZE = 2;

    private final A label;
    private final B value;
    
    
    
    public static <A,B> LabelValue<A,B> with(final A label, final B value) {
        return new LabelValue<A,B>(label,value);
    }

    
    /**
     * <p>
     * Create tuple from array. Array has to have exactly two elements.
     * </p>
     * 
     * @param <X> the array component type 
     * @param array the array to be converted to a tuple
     * @return the tuple
     */
    public static <X> LabelValue<X,X> fromArray(final X[] array) {
        if (array == null) {
            throw new IllegalArgumentException("Array cannot be null");
        }
        if (array.length != 2) {
            throw new IllegalArgumentException("Array must have exactly 2 elements in order to create a LabelValue. Size is " + array.length);
        }
        return new LabelValue<X,X>(array[0],array[1]);
    }

    
    public static <X> LabelValue<X,X> fromCollection(final Collection<X> collection) {
        return fromIterable(collection);
    }


    
    public static <X> LabelValue<X,X> fromIterable(final Iterable<X> iterable) {
        return fromIterable(iterable, 0, true);
    }

    
    
    public static <X> LabelValue<X,X> fromIterable(final Iterable<X> iterable, int index) {
        return fromIterable(iterable, index, false);
    }
    

    
    private static <X> LabelValue<X,X> fromIterable(final Iterable<X> iterable, int index, final boolean exactSize) {<FILL_FUNCTION_BODY>}
    
    
    
    
    public LabelValue(
            final A label, 
            final B value) {
        super(label, value);
        this.label = label;
        this.value = value;
    }


    public A getLabel() {
        return this.label;
    }


    public B getValue() {
        return this.value;
    }


    @Override
    public int getSize() {
        return SIZE;
    }
    
    
    
    public <X> LabelValue<X,B> setLabel(final X label) {
        return new LabelValue<X,B>(label, this.value);
    }
    
    
    public <Y> LabelValue<A,Y> setValue(final Y value) {
        return new LabelValue<A,Y>(this.label, value);
    }
    
    
    
    
    
}

        
        if (iterable == null) {
            throw new IllegalArgumentException("Iterable cannot be null");
        }

        boolean tooFewElements = false; 
        
        X element0 = null;
        X element1 = null;
        
        final Iterator<X> iter = iterable.iterator();
        
        int i = 0;
        while (i < index) {
            if (iter.hasNext()) {
                iter.next();
            } else {
                tooFewElements = true;
            }
            i++;
        }
        
        if (iter.hasNext()) {
            element0 = iter.next();
        } else {
            tooFewElements = true;
        }
        
        if (iter.hasNext()) {
            element1 = iter.next();
        } else {
            tooFewElements = true;
        }
        
        if (tooFewElements && exactSize) {
            throw new IllegalArgumentException("Not enough elements for creating a LabelValue (2 needed)");
        }
        
        if (iter.hasNext() && exactSize) {
            throw new IllegalArgumentException("Iterable must have exactly 2 available elements in order to create a LabelValue.");
        }
        
        return new LabelValue<X,X>(element0, element1);
        
    
<methods>public int compareTo(org.nlpcn.commons.lang.util.tuples.Tuple) ,public final boolean contains(java.lang.Object) ,public final boolean containsAll(Collection<?>) ,public final transient boolean containsAll(java.lang.Object[]) ,public final boolean equals(java.lang.Object) ,public abstract int getSize() ,public final java.lang.Object getValue(int) ,public final int hashCode() ,public final int indexOf(java.lang.Object) ,public final Iterator<java.lang.Object> iterator() ,public final int lastIndexOf(java.lang.Object) ,public final java.lang.Object[] toArray() ,public final List<java.lang.Object> toList() ,public final java.lang.String toString() <variables>private static final long serialVersionUID,private final non-sealed java.lang.Object[] valueArray,private final non-sealed List<java.lang.Object> valueList