cern.colt.list.adapter
public class ObjectListAdapter extends java.util.AbstractList implements java.util.List
ObjectArrayList
to be viewed and treated as a JDK 1.2 AbstractList
.
Makes the contained list compatible with the JDK 1.2 Collections Framework.Constructor and Description |
---|
ObjectListAdapter(ObjectArrayList content)
Constructs a list backed by the specified content list.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
java.lang.Object element)
Inserts the specified element at the specified position in this list
(optional operation).
|
java.lang.Object |
get(int index)
Returns the element at the specified position in this list.
|
java.lang.Object |
remove(int index)
Removes the element at the specified position in this list (optional
operation).
|
java.lang.Object |
set(int index,
java.lang.Object element)
Replaces the element at the specified position in this list with the
specified element (optional operation).
|
int |
size()
Returns the number of elements in this list.
|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList
public ObjectListAdapter(ObjectArrayList content)
public void add(int index, java.lang.Object element)
add
in interface java.util.List
add
in class java.util.AbstractList
index
- index at which the specified element is to be inserted.element
- element to be inserted.java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this list.java.lang.IllegalArgumentException
- if some aspect of the specified
element prevents it from being added to this list.java.lang.IndexOutOfBoundsException
- index is out of range (index <
0 || index > size()).public java.lang.Object get(int index)
get
in interface java.util.List
get
in class java.util.AbstractList
index
- index of element to return.java.lang.IndexOutOfBoundsException
- if the given index is out of range
(index < 0 || index >= size()).public java.lang.Object remove(int index)
remove
in interface java.util.List
remove
in class java.util.AbstractList
index
- the index of the element to remove.java.lang.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
set
in class java.util.AbstractList
index
- index of element to replace.element
- element to be stored at the specified position.java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this list.java.lang.IllegalArgumentException
- if some aspect of the specified
element prevents it from being added to this list.java.lang.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public int size()
size
in interface java.util.Collection
size
in interface java.util.List
size
in class java.util.AbstractCollection
Jump to the Colt Homepage