|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.python.core.PyObject
org.python.modules._collections.PyDeque
public class PyDeque
PyDeque - This class implements the functionalities of Deque data structure. Deques are a generalization of stacks and queues (the name is pronounced 'deck' and is short for 'double-ended queue'). Deques support thread-safe, memory efficient appends and pops from either side of the deque with approximately the same O(1) performance in either direction. Though list objects support similar operations, they are optimized for fast fixed-length operations and incur O(n) memory movement costs for pop(0) and insert(0, v) operations which change both the size and position of the underlying data representation. collections.deque([iterable]) - returns a new deque object initialized left-to-right (using append()) with data from iterable. If iterable is not specified, the new deque is empty.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.python.core.PyObject |
---|
PyObject.ConversionException |
Field Summary | |
---|---|
static PyType |
TYPE
|
Constructor Summary | |
---|---|
PyDeque()
|
|
PyDeque(PyType subType)
|
Method Summary | |
---|---|
void |
__delitem__(PyObject key)
Equivalent to the standard Python __delitem__ method. |
PyObject |
__eq__(PyObject o)
Equivalent to the standard Python __eq__ method. |
PyObject |
__finditem__(PyObject key)
Very similar to the standard Python __getitem__ method. |
PyObject |
__ge__(PyObject o)
Equivalent to the standard Python __ge__ method. |
PyObject |
__gt__(PyObject o)
Equivalent to the standard Python __gt__ method. |
PyObject |
__iter__()
Return an iterator that is used to iterate the element of this sequence. |
PyObject |
__le__(PyObject o)
Equivalent to the standard Python __le__ method. |
int |
__len__()
Equivalent to the standard Python __len__ method. |
PyObject |
__lt__(PyObject o)
Equivalent to the standard Python __lt__ method. |
PyObject |
__ne__(PyObject o)
Equivalent to the standard Python __ne__ method. |
boolean |
__nonzero__()
Equivalent to the standard Python __nonzero__ method. |
PyObject |
__reduce__()
Used for pickling. |
void |
__setitem__(PyObject index,
PyObject value)
Equivalent to the standard Python __setitem__ method. |
int |
hashCode()
|
boolean |
isMappingType()
|
boolean |
isSequenceType()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final PyType TYPE
Constructor Detail |
---|
public PyDeque()
public PyDeque(PyType subType)
Method Detail |
---|
public String toString()
toString
in class PyObject
public int __len__()
PyObject
__len__
in class PyObject
public boolean __nonzero__()
PyObject
PyObject
is considered true.
__nonzero__
in class PyObject
public PyObject __finditem__(PyObject key)
PyObject
__finditem__
in class PyObject
key
- the key to lookup in this container
public void __setitem__(PyObject index, PyObject value)
PyObject
__setitem__
in class PyObject
index
- the key whose value will be setvalue
- the value to set this key topublic void __delitem__(PyObject key)
PyObject
__delitem__
in class PyObject
key
- the key to be removed from the containerpublic PyObject __iter__()
PyObject
If a PyObject subclass should support iteration based in the __finditem__() method, it must supply an implementation of __iter__() like this:
public PyObject __iter__() { return new PySequenceIter(this); }When iterating over a python sequence from java code, it should be done with code like this:
for (PyObject item : seq.asIterable()) { // Do somting with item }
__iter__
in class PyObject
public PyObject __eq__(PyObject o)
PyObject
__eq__
in class PyObject
o
- the object to compare this with.
public PyObject __ne__(PyObject o)
PyObject
__ne__
in class PyObject
o
- the object to compare this with.
public PyObject __lt__(PyObject o)
PyObject
__lt__
in class PyObject
o
- the object to compare this with.
public PyObject __le__(PyObject o)
PyObject
__le__
in class PyObject
o
- the object to compare this with.
public PyObject __gt__(PyObject o)
PyObject
__gt__
in class PyObject
o
- the object to compare this with.
public PyObject __ge__(PyObject o)
PyObject
__ge__
in class PyObject
o
- the object to compare this with.
public int hashCode()
hashCode
in class PyObject
public PyObject __reduce__()
PyObject
__reduce__
in class PyObject
public boolean isMappingType()
isMappingType
in class PyObject
public boolean isSequenceType()
isSequenceType
in class PyObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |