Top Inners Fields Constructors Methods
org.python.core

public Class PyList

extends PySequenceList
Class Inheritance
Known Direct Subclasses
org.python.core.PyListDerived
Annotations
@ExposedType
name:list
base:PyObject
doc:list() -> new empty list list(iterable) -> new list initialized from iterable\'s items
Imports
java.util.ArrayList, .Arrays, .Collection, .Collections, .Comparator, .ConcurrentModificationException, .HashMap, .Iterator, .List, .ListIterator, .Map, org.python.expose.ExposedMethod, .ExposedNew, .ExposedType, .MethodType, org.python.util.Generic, java.lang.reflect.Array

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
public volatile int
private final List<PyObject>
public static final PyType

Constructor Summary

AccessConstructor and Description
public
public
PyList(PyType type)

private
PyList(List<?> list, boolean convert)

public
PyList(PyType type, PyObject[] elements)

public
PyList(PyType type, Collection<E> c)

public
PyList(PyObject[] elements)

public
public
public

Method Summary

Modifier and TypeMethod and Description
public PyObject
__add__(PyObject
the object to perform this binary operation with (the right-hand operand).
o
)

Overrides org.python.core.PyObject.__add__.

Equivalent to the standard Python __add__ method.

public PyTuple
public PyObject
__iadd__(PyObject
the object to perform this binary operation with (the right-hand operand).
o
)

Overrides org.python.core.PyObject.__iadd__.

Equivalent to the standard Python __iadd__ method.

public PyObject
__imul__(PyObject
the object to perform this binary operation with (the right-hand operand).
o
)

Overrides org.python.core.PyObject.__imul__.

Equivalent to the standard Python __imul__ method.

public PyObject
__iter__()

Overrides org.python.core.PySequence.__iter__.

Return an iterator that is used to iterate the element of this sequence.

public int
__len__()

Overrides org.python.core.PyObject.__len__.

Equivalent to the standard Python __len__ method.

public PyObject
__mul__(PyObject
the object to perform this binary operation with (the right-hand operand).
o
)

Overrides org.python.core.PyObject.__mul__.

Equivalent to the standard Python __mul__ method.

public PyObject
__radd__(PyObject
the object to perform this binary operation with (the left-hand operand).
o
)

Overrides org.python.core.PyObject.__radd__.

Equivalent to the standard Python __radd__ method.

public PyIterator
public PyObject
__rmul__(PyObject
the object to perform this binary operation with (the left-hand operand).
o
)

Overrides org.python.core.PyObject.__rmul__.

Equivalent to the standard Python __rmul__ method.

private int
_index(PyObject o, String message, int start, int stop)

public void
add(int
index at which the specified element is to be inserted
index
,
Object
element to be inserted
element
)

Implements abstract org.python.core.PySequenceList.add.

Implements java.util.List.add.

Inserts the specified element at the specified position in this list (optional operation).

public boolean
add(Object
element to be appended to this list
o
)

Implements abstract org.python.core.PySequenceList.add.

Implements java.util.List.add.

Appends the specified element to the end of this list (optional operation).

public synchronized boolean
addAll(int
index at which to insert the first element from the specified collection
index
,
Collection<E>
collection containing elements to be added to this list
c
)

Implements abstract org.python.core.PySequenceList.addAll.

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list at the specified position (optional operation).

public boolean
addAll(Collection<E>
collection containing elements to be added to this list
c
)

Implements abstract org.python.core.PySequenceList.addAll.

Implements java.util.List.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

private static void
public void
append(PyObject
the element to add.
o
)

Add a single element to the end of list.

public synchronized void
clear()

Implements abstract org.python.core.PySequenceList.clear.

Implements java.util.List.clear.

Removes all of the elements from this list (optional operation).

public synchronized boolean
contains(Object
element whose presence in this list is to be tested
o
)

Implements abstract org.python.core.PySequenceList.contains.

Implements java.util.List.contains.

Returns true if this list contains the specified element.

public synchronized boolean
containsAll(Collection<E>
collection to be checked for containment in this list
c
)

Implements abstract org.python.core.PySequenceList.containsAll.

Implements java.util.List.containsAll.

Returns true if this list contains all of the elements of the specified collection.

public int
count(PyObject
the argument to test for. Testing is done with the == operator.
o
)

Return the number elements in the list that equals the argument.

protected void
del(int
index of the element to delete.
i
)

Overrides org.python.core.PySequence.del.

Deletes an element from the sequence (and closes up the gap).

protected void
delRange(int
the position of the first element.
start
,
int
one more than the position of the last element.
stop
)

Overrides org.python.core.PySequence.delRange.

Deletes a contiguous sub-sequence (and closes up the gap).

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

Implements abstract org.python.core.PySequenceList.equals.

Implements java.util.List.equals.

Compares the specified object with this list for equality.

public void
extend(PyObject
the sequence of items to append to the list.
o
)

Append the elements in the argument sequence to the end of the list.

public static PyList
public synchronized Object
get(int
index of the element to return
index
)

Implements abstract org.python.core.PySequenceList.get.

Implements java.util.List.get.

Returns the element at the specified position in this list.

public synchronized PyObject[]
getArray()

Implements abstract org.python.core.PySequenceList.getArray.

Get the backing array.

pack-priv List<PyObject>
protected PyObject
getslice(int
the position of the first element.
start
,
int
one more than the position of the last element.
stop
,
int
the step size.
step
)

Implements abstract org.python.core.PySequence.getslice.

Returns a range of elements from the sequence.

public int
hashCode()

Implements abstract org.python.core.PySequenceList.hashCode.

Implements java.util.List.hashCode.

Returns the hash code value for this list.

public int
index(PyObject
the argument to test for. Testing is done with the == operator.
o
)

return smallest index where an element in the list equals the argument.

public int
index(PyObject o, int start)

public int
index(PyObject o, int start, int stop)

public synchronized int
indexOf(Object
element to search for
o
)

Implements abstract org.python.core.PySequenceList.indexOf.

Implements java.util.List.indexOf.

Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.

public void
insert(int
the position where the element will be inserted.
index
,
PyObject
the element to insert.
o
)

Insert the argument element into the list at the specified index.

public synchronized boolean
isEmpty()

Implements abstract org.python.core.PySequenceList.isEmpty.

Implements java.util.List.isEmpty.

Returns true if this list contains no elements.

public Iterator<Object>
iterator()

Implements abstract org.python.core.PySequenceList.iterator.

Implements java.util.List.iterator.

Returns an iterator over the elements in this list in proper sequence.

public synchronized int
lastIndexOf(Object
element to search for
o
)

Implements abstract org.python.core.PySequenceList.lastIndexOf.

Implements java.util.List.lastIndexOf.

Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.

pack-priv final synchronized PyObject
pack-priv final synchronized boolean
pack-priv final synchronized void
pack-priv final synchronized void
pack-priv final synchronized PyObject
pack-priv final synchronized PyObject
pack-priv final synchronized PyObject
pack-priv final synchronized PyObject
pack-priv final synchronized PyObject
pack-priv final synchronized int
pack-priv final synchronized PyObject
pack-priv final synchronized PyObject
pack-priv final void
list___init__(PyObject[] args, String[] kwds)

pack-priv final PyObject
pack-priv final synchronized PyObject
pack-priv final synchronized int
pack-priv final synchronized PyObject
pack-priv final synchronized PyObject
pack-priv final synchronized PyObject
pack-priv final synchronized PyObject
pack-priv final synchronized PyIterator
pack-priv final synchronized PyObject
pack-priv final synchronized void
pack-priv final synchronized void
pack-priv final synchronized void
pack-priv final synchronized int
pack-priv final synchronized void
pack-priv final synchronized int
pack-priv final synchronized int
list_index(PyObject o, int start, int stop)

pack-priv final synchronized int
list_index(PyObject o, int start)

pack-priv final synchronized int
pack-priv final synchronized void
list_insert(int index, PyObject o)

pack-priv final synchronized PyObject
list_pop(int n)

pack-priv final synchronized void
pack-priv final synchronized void
pack-priv final synchronized void
list_sort(PyObject[] args, String[] kwds)

Sort the items of the list in place.

pack-priv final synchronized String
private static List<PyObject>
public ListIterator<E>
listIterator()

Implements abstract org.python.core.PySequenceList.listIterator.

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence).

public ListIterator<E>
listIterator(final int
index of the first element to be returned from the list iterator (by a call to next)
index
)

Implements abstract org.python.core.PySequenceList.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 PyObject
pop()

Removes and return the last element in the list.

public PyObject
pop(int
the index of the element to remove and return.
n
)

Removes and return the n indexed element in the list.

public synchronized void
pyadd(int index, PyObject element)

Implements abstract org.python.core.PySequenceList.pyadd.

public synchronized boolean
public synchronized PyObject
pyget(int
index of element to return.
index
)

Implements abstract org.python.core.PySequenceList.pyget.

Returns the element of the sequence at the given index.

public synchronized void
pyset(int
index of the element to set.
index
,
PyObject
the value to set this element to.
element
)

Implements abstract org.python.core.PySequenceList.pyset.

Sets the indexed element of the sequence to the given value.

public boolean
public void
remove(PyObject
the element to search for and remove.
o
)

Remove the first occurence of the argument from the list.

public synchronized Object
remove(int
the index of the element to be removed
index
)

Implements abstract org.python.core.PySequenceList.remove.

Implements java.util.List.remove.

Removes the element at the specified position in this list (optional operation).

public synchronized void
remove(int start, int stop)

Implements abstract org.python.core.PySequenceList.remove.

public synchronized boolean
remove(Object
element to be removed from this list, if present
o
)

Implements abstract org.python.core.PySequenceList.remove.

Implements java.util.List.remove.

Removes the first occurrence of the specified element from this list, if it is present (optional operation).

public synchronized boolean
removeAll(Collection<E>
collection containing elements to be removed from this list
c
)

Implements abstract org.python.core.PySequenceList.removeAll.

Implements java.util.List.removeAll.

Removes from this list all of its elements that are contained in the specified collection (optional operation).

protected synchronized PyObject
repeat(int
the number of times to repeat the sequence.
count
)

Implements abstract org.python.core.PySequence.repeat.

Returns a (concrete subclass of) PySequence that repeats the given sequence, as in the implementation of __mul__ for strings.

public synchronized boolean
retainAll(Collection<E>
collection containing elements to be retained in this list
c
)

Implements abstract org.python.core.PySequenceList.retainAll.

Implements java.util.List.retainAll.

Retains only the elements in this list that are contained in the specified collection (optional operation).

public void
reverse()

Reverses the items of s in place.

public synchronized Object
set(int
index of the element to replace
index
,
Object
element to be stored at the specified position
element
)

Implements abstract org.python.core.PySequenceList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element (optional operation).

protected void
setslice(int
the position of the first element.
start
,
int
one more than the position of the last element.
stop
,
int
the step size.
step
,
PyObject
an object consistent with the slice assignment
value
)

Overrides org.python.core.PySequence.setslice.

Sets the given range of elements according to Python slice assignment semantics.

private final void
setsliceIterator(int start, int stop, int step, Iterator<PyObject> iter)

private final void
setsliceList(int start, int stop, int step, List<Object> value)

private final void
setslicePyList(int start, int stop, int step, PyList other)

public synchronized int
size()

Implements abstract org.python.core.PySequenceList.size.

Implements java.util.List.size.

Returns the number of elements in this list.

public void
sort(PyObject cmp, PyObject key, PyObject reverse)

public void
sort()

private synchronized void
sort(boolean reverse)

public void
sort(PyObject compare)

private synchronized void
sort(PyObject compare, boolean reverse)

private synchronized void
sort(PyObject cmp, PyObject key, boolean reverse)

public synchronized List<E>
subList(int
low endpoint (inclusive) of the subList
fromIndex
,
int
high endpoint (exclusive) of the subList
toIndex
)

Implements abstract org.python.core.PySequenceList.subList.

Implements java.util.List.subList.

Returns a view of the portion of this list between the specified fromIndex, inclusive, and toIndex, exclusive.

public synchronized Object[]
toArray()

Implements abstract org.python.core.PySequenceList.toArray.

Implements java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element).

public synchronized Object[]
toArray(Object[]
the array into which the elements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
a
)

Implements abstract org.python.core.PySequenceList.toArray.

Implements java.util.List.toArray.

Returns an array containing all of the elements in this list in proper sequence (from first to last element); the runtime type of the returned array is that of the specified array.

public String
toString()

Implements abstract org.python.core.PySequenceList.toString.

Returns a string representation of the object.

public int
traverse(Visitproc visit, Object arg)

Overrides org.python.core.PySequenceList.traverse.

Implements org.python.core.Traverseproc.traverse.

Traverses all directly contained PyObjects.

protected String
unsupportedopMessage(String op, PyObject o2)

Overrides org.python.core.PySequence.unsupportedopMessage.

Return sequence-specific error messages suitable for substitution.