Package org.apache.flink.api.java.tuple
Class Tuple4<T0,T1,T2,T3>
- java.lang.Object
-
- org.apache.flink.api.java.tuple.Tuple
-
- org.apache.flink.api.java.tuple.Tuple4<T0,T1,T2,T3>
-
- Type Parameters:
T0
- The type of field 0T1
- The type of field 1T2
- The type of field 2T3
- The type of field 3
- All Implemented Interfaces:
Serializable
@Public public class Tuple4<T0,T1,T2,T3> extends Tuple
A tuple with 4 fields. Tuples are strongly typed; each field may be of a separate type. The fields of the tuple can be accessed directly as public fields (f0, f1, ...) or via their position through thegetField(int)
method. The tuple field positions start at zero.Tuples are mutable types, meaning that their fields can be re-assigned. This allows functions that work with Tuples to reuse objects in order to reduce pressure on the garbage collector.
Warning: If you subclass Tuple4, then be sure to either
- not add any new fields, or
- make it a POJO, and always declare the element type of your DataStreams/DataSets to your descendant type. (That is, if you have a "class Foo extends Tuple4", then don't use instances of Foo in a DataStream<Tuple4> / DataSet<Tuple4>, but declare it as DataStream<Foo> / DataSet<Foo>.)
- See Also:
Tuple
, Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Tuple4<T0,T1,T2,T3>
copy()
Shallow tuple copy.boolean
equals(Object o)
Deep equality for tuples by calling equals() on the tuple members.int
getArity()
Gets the number of field in the tuple (the tuple arity).<T> T
getField(int pos)
Gets the field at the specified position.int
hashCode()
static <T0,T1,T2,T3>
Tuple4<T0,T1,T2,T3>of(T0 f0, T1 f1, T2 f2, T3 f3)
Creates a new tuple and assigns the given values to the tuple's fields.<T> void
setField(T value, int pos)
Sets the field at the specified position.void
setFields(T0 f0, T1 f1, T2 f2, T3 f3)
Sets new values to all fields of the tuple.String
toString()
Creates a string representation of the tuple in the form (f0, f1, f2, f3), where the individual fields are the value returned by callingObject.toString()
on that field.-
Methods inherited from class org.apache.flink.api.java.tuple.Tuple
getFieldNotNull, getTupleClass, newInstance
-
-
-
-
Method Detail
-
getArity
public int getArity()
Description copied from class:Tuple
Gets the number of field in the tuple (the tuple arity).
-
getField
public <T> T getField(int pos)
Description copied from class:Tuple
Gets the field at the specified position.
-
setField
public <T> void setField(T value, int pos)
Description copied from class:Tuple
Sets the field at the specified position.
-
setFields
public void setFields(T0 f0, T1 f1, T2 f2, T3 f3)
Sets new values to all fields of the tuple.- Parameters:
f0
- The value for field 0f1
- The value for field 1f2
- The value for field 2f3
- The value for field 3
-
toString
public String toString()
Creates a string representation of the tuple in the form (f0, f1, f2, f3), where the individual fields are the value returned by callingObject.toString()
on that field.
-
equals
public boolean equals(Object o)
Deep equality for tuples by calling equals() on the tuple members.
-
of
public static <T0,T1,T2,T3> Tuple4<T0,T1,T2,T3> of(T0 f0, T1 f1, T2 f2, T3 f3)
Creates a new tuple and assigns the given values to the tuple's fields. This is more convenient than using the constructor, because the compiler can infer the generic type arguments implicitly. For example:Tuple3.of(n, x, s)
instead ofnew Tuple3<Integer, Double, String>(n, x, s)
-
-