Top Description Inners Fields Constructors Methods
org.python.core

public Class PyTuple

extends AbstractList<Object>
implements CraftedPyObject
Class Inheritance
All Implemented Interfaces
org.python.core.CraftedPyObject
Imports
java.lang.invoke.MethodHandles, java.util.AbstractList, .Arrays, .Collection, .Iterator, .ListIterator, .NoSuchElementException, .StringJoiner, java.util.stream.Stream, org.python.base.InterpreterError, org.python.core.PyObjectUtil.NoConversion, .PySlice.Indices, .PyType.Spec

The Python tuple object.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
PyTuple.Builder

A class for constructing a tuple element-wise.

pack-priv class
PyTuple.TupleDelegate

Wrap this PyTuple as a PySequence.

Field Summary

Modifier and TypeField and Description
private PyTuple.TupleDelegate
delegate

Implementation help for sequence methods.

pack-priv static final PyTuple
EMPTY

Convenient constant for a tuple with zero elements.

private static final int
private static final int
private static final int
public static final PyType
TYPE

The Python type object for tuple.

protected final PyType
type

The Python type of this instance.

pack-priv final Object[]
value

The elements of the tuple.

Inherited from java.util.AbstractList:
modCount

Constructor Summary

AccessConstructor and Description
private <E>
PyTuple(PyType
sub-type for which this is being created
type
,
boolean
if true try to re-use the array, otherwise make a copy.
iPromiseNotToModifyTheArray
,
E[]
of the tuple
value
)

Potentially unsafe constructor, capable of creating a "tuple view" of an array, or a copy.

public <
Actual element type
E
>
PyTuple(E...
of the tuple
elements
)

Construct a PyTuple from an array of Objects or zero or more Object arguments.

protected <
element type of the tuple internally
E
>
PyTuple(PyType
actual Python sub-class to being created
type
,
E...
of the tuple
elements
)

As PyTuple(Object.

pack-priv
PyTuple(Collection<?>
source of element values for this tuple
c
)

Construct a PyTuple from the elements of a collection.

protected
PyTuple(PyType
actual Python sub-class to being created
type
,
Collection<?>
elements of the tuple
c
)

As PyTuple(Collection) for Python sub-class specifying type.

pack-priv
PyTuple(Stream<?>
source of element values for this tuple
s
)

Construct a PyTuple from the elements of a stream.

protected
PyTuple(PyType
actual Python type to construct
type
,
Object[]
source of element values
a
,
int
first element to include
start
,
int
number of elements to take
count
)

As PyTuple(Object[], int, int) for Python sub-class specifying type.

pack-priv
PyTuple(Object[]
source of element values
a
,
int
first element to include
start
,
int
number of elements to take
count
)

Construct a PyTuple from an array of Objects or zero or more Object arguments provided as a slice of an array.

Method Summary

Modifier and TypeMethod and Description
private Object
private boolean
private Object
private Object
private Object
private PyTuple
private Object
private int
private Object
private int
private Object
private Object
private Object
private Object
private Object
private static PyTuple
concat(Object[] v, Object[] w)

Concatenate two arrays into a tuple (for TupleAdapter).

private int
public boolean
equals(Object
the object to be compared for equality with this list
other
)

Overrides java.util.AbstractList.equals.

Implements java.util.List.equals, java.util.Collection.equals.

Compares the specified object with this list for equality.
pack-priv static <
component type
E
>
PyTuple

Returns:

a tuple with the given contents or EMPTY
from
(E[]
value of new tuple
a
)

Construct a PyTuple from the elements of an array, or if the collection is empty, return EMPTY.

pack-priv static <
component type
E
>
PyTuple

Returns:

a tuple with the given contents or EMPTY
from
(Collection<E>
value of new tuple
c
)

Construct a PyTuple from the elements of a collection, or if the collection is empty, return EMPTY.

public Object
get(int
index of the element to return
i
)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.
public PyType
getType()

Implements org.python.core.CraftedPyObject.getType.

The Python type of this object.
public int
hashCode()

Overrides java.util.AbstractList.hashCode.

Implements java.util.List.hashCode, java.util.Collection.hashCode.

Returns the hash code value for this list.
private Object
index(Object v, Object start, Object stop)

public Iterator<Object>
iterator()

Overrides java.util.AbstractList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this list in proper sequence.
public ListIterator<Object>
listIterator(final int
index of the first element to be returned from the list iterator (by a call to next)
index
)

Overrides java.util.AbstractList.listIterator.

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence), starting at the specified position in the list.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Returns the number of elements in this list.
public String
toString()

Overrides java.util.AbstractCollection.toString.

Returns a string representation of this collection.
private static <
component type of the array in the new tuple
E
>
PyTuple

Returns:

a tuple with the given contents or EMPTY
wrap
(E[]
of the new tuple or null
value
)

Unsafely wrap an array of Object in a "tuple view".

Inherited from java.util.AbstractList:
addaddaddAllclearindexOflastIndexOflistIteratorremoveremoveRangesetsubList