T0
- The type of field 0@Public public class Tuple1<T0> extends Tuple
getField(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 Tuple1, then be sure to either
Tuple
,
Serialized FormConstructor and Description |
---|
Tuple1()
Creates a new tuple where all fields are null.
|
Tuple1(T0 f0)
Creates a new tuple and assigns the given values to the tuple's fields.
|
Modifier and Type | Method and Description |
---|---|
Tuple1<T0> |
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> Tuple1<T0> |
of(T0 f0)
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)
Sets new values to all fields of the tuple.
|
String |
toString()
Creates a string representation of the tuple in the form (f0), where the individual fields
are the value returned by calling
Object.toString() on that field. |
getFieldNotNull, getTupleClass, newInstance
public T0 f0
public Tuple1()
public Tuple1(T0 f0)
f0
- The value for field 0public int getArity()
Tuple
public <T> T getField(int pos)
Tuple
public <T> void setField(T value, int pos)
Tuple
public void setFields(T0 f0)
f0
- The value for field 0public String toString()
Object.toString()
on that field.public boolean equals(Object o)
public static <T0> Tuple1<T0> of(T0 f0)
Tuple3.of(n, x, s)
instead of new
Tuple3<Integer, Double, String>(n, x, s)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.