Tuple
Date: 2014-06-04

org.gcube.vremanagement.resourcebroker.impl.support.types

## Class Tuple<T>

- java.lang.Object
- - org.gcube.vremanagement.resourcebroker.impl.support.types.Tuple<T>

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<T>

      public class Tuple<T>
      extends java.lang.Object
      implements java.lang.Iterable<T>, java.io.Serializable

  General purpose tuple representation. A tuple is a sequence (or ordered list) of finite length.

       Example:

       1) Creation
       // single typed tuple
       Tuple<Long> nt = new Tuple<Long>(42L);

       // multi typed tuple
       Tuple<Object> ot = new Tuple<Object>("Lars Tackmann",
                      "Age", 26);

       2) Usage
       // get single element
       Integer val = (Integer) ot.get(2);
       // iterate tuple
       for (Object o : ot)
         System.out.printf("'%s' ", o.toString());
       // print all elems
       System.out.printf("Object tuple: %s\n", ot.toString());

       3) Operations
       // The elements of two tuples a and b can be joined with
       // union operation that returns a new tuple.
       Tuple c = a.union (b);

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Tuple()`
    `Tuple(T... args)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `append(T... args)` Appends elements inside a tuple.
    `boolean` | `equals(java.lang.Object obj)` Compares two tuples.
    `T` | `get(int index)`
    `java.util.List<T>` | `getContent()` Deprecated. For serialization purpose use the other constructors
    `int` | `hashCode()`
    `java.util.Iterator<T>` | `iterator()`
    `void` | `setContent(java.util.List<T> content)` Deprecated. For serialization purpose use the other constructors
    `int` | `size()`
    `java.lang.String` | `toString()`
    `Tuple<? extends T>` | `union(Tuple<? extends T> t)`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Tuple

          public Tuple()

    - #### Tuple

          public Tuple(T... args)

  - ### Method Detail

    - #### getContent

          public final java.util.List<T> getContent()

      Deprecated. For serialization purpose use the other constructors

    - #### setContent

          public final void setContent(java.util.List<T> content)

      Deprecated. For serialization purpose use the other constructors

    - #### append

          public final void append(T... args)

      Appends elements inside a tuple.

    - #### union

          public final Tuple<? extends T> union(Tuple<? extends T> t)

    - #### get

          public final T get(int index)

    - #### iterator

          public final java.util.Iterator<T> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<T>`

    - #### size

          public final int size()

    - #### equals

          public final boolean equals(java.lang.Object obj)

      Compares two tuples. The comparison is applied to all the contained elements.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the `Tuple` element to compare
      Returns:
        true if the number of contained elements is the same and all the elements are equals.

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public final java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`