public class PyObjectArray extends AbstractArray
java.util.List
.Constructor and Description |
---|
PyObjectArray()
Create the array with the specified size.
|
PyObjectArray(int size)
Create the array with the specified size.
|
PyObjectArray(PyObject[] rawArray) |
PyObjectArray(PyObjectArray toCopy) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
PyObject value)
Add a value at a specified index in the array.
|
int |
add(PyObject value)
Add a value to the array, appending it after the current values.
|
java.lang.Object |
clone()
Duplicates the object with the generic call.
|
void |
ensureCapacity(int minCapacity)
Ensures that the base array has at least the specified
minimum capacity.
|
boolean |
equals(java.lang.Object o) |
PyObject |
get(int index)
Retrieve the value present at an index position in the array.
|
java.lang.Object |
getArray()
Get the backing array.
|
int |
hashCode() |
void |
remove(int start,
int stop)
Removes a range from the array at the specified indices.
|
PyObject |
set(int index,
PyObject value)
Set the value at an index position in the array.
|
PyObject[] |
toArray()
Constructs and returns a simple array containing the same data as held
in this growable array.
|
appendArray, clear, copyArray, getModCountIncr, getSize, remove, replaceSubArray, replaceSubArray, setSize, toString
public PyObjectArray()
public PyObjectArray(PyObject[] rawArray)
public PyObjectArray(int size)
size
- number of int values initially allowed in arraypublic PyObjectArray(PyObjectArray toCopy)
toCopy
- public void remove(int start, int stop)
AbstractArray
remove
in class AbstractArray
start
- inclusivestop
- exclusivepublic void add(int index, PyObject value)
AbstractList
subclasses should update their
modCount
after calling this method.
index
- index position at which to insert elementvalue
- value to be inserted into arraypublic int add(PyObject value)
AbstractList
subclasses should update their
modCount
after calling this method.
value
- value to be addedpublic java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public PyObject get(int index)
index
- index position for value to be retrievedpublic java.lang.Object getArray()
toArray()
which returns a copy. Note that
getSize()
should be used to determine the number of elements
in the array, not the array's length (which may reflect excess capacity).
toArray()
returns an array whose length equals the value
returned by getSize()
.public PyObject set(int index, PyObject value)
index
- index position to be setvalue
- value to be setpublic PyObject[] toArray()
getSize()
public void ensureCapacity(int minCapacity)
AbstractArray
AbstractList
subclasses should update their
modCount
after calling this method.
minCapacity
- new minimum size required