Class Tuple<T>
- java.lang.Object
-
- org.gcube.resourcemanagement.support.shared.types.Tuple<T>
-
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable,Serializable,Iterable<T>
public class Tuple<T> extends Object implements Iterable<T>, Serializable, com.google.gwt.user.client.rpc.IsSerializable
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidappend(T... args)Appends elements inside a tuple.booleanequals(Object obj)Compares two tuples.Tget(int index)List<T>getContent()Deprecated.For serialization purpose use the other constructorsinthashCode()Iterator<T>iterator()voidsetContent(List<T> content)Deprecated.For serialization purpose use the other constructorsintsize()StringtoString()Tuple<? extends T>union(Tuple<? extends T> t)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
Tuple
public Tuple()
Deprecated.For serialization purpose use the other constructors
-
Tuple
public Tuple(T... args)
-
-
Method Detail
-
getContent
public final List<T> getContent()
Deprecated.For serialization purpose use the other constructors
-
setContent
public final void setContent(List<T> content)
Deprecated.For serialization purpose use the other constructors
-
append
public final void append(T... args)
Appends elements inside a tuple.
-
get
public final T get(int index)
-
size
public final int size()
-
equals
public final boolean equals(Object obj)
Compares two tuples. The comparison is applied to all the contained elements.
-
-