Methods Summary |
---|
public void | add(int i, java.lang.Object o)Unlike the general contract of List, this will replace, not insert
before, the object at the given index.
ensureCapacity(i);
data[i] = o;
|
public boolean | add(java.lang.Object o)Add the given object to the end of the list
ensureCapacity(hwm);
data[hwm++] = o;
return true;
|
public boolean | addAll(java.util.Collection c)
Iterator it = c.iterator();
while (it.hasNext()) {
add(it.next());
}
return true;
|
public boolean | addAll(int i, java.util.Collection c)
throw new IllegalStateException(
"addAll method not implemented in IndexList");
|
public void | clear()
data = new Object[DEFAULT_START_SIZE];
hwm = 0;
|
public boolean | contains(java.lang.Object o)
return indexOf(o) >= 0;
|
public boolean | containsAll(java.util.Collection c)
Iterator it = c.iterator();
while (it.hasNext()) {
if (indexOf(it.next()) == -1) {
return false;
}
}
return true;
|
public void | ensureCapacity(int i)
if (i > data.length) {
Object newData = new Object[i + 10];
System.arraycopy(data, 0, newData, 0, hwm);
}
|
public java.lang.Object | get(int i)
return data[i];
|
public int | hashCode()
return data.hashCode();
|
public int | indexOf(java.lang.Object o)Find the location where this object is referenced, or null
for (int i=0; i<hwm; i++) {
if (o == data[i]) {
return i;
}
}
return -1;
|
public boolean | isEmpty()
return hwm > 0;
|
public java.util.Iterator | iterator()
Object[] newData = new Object[hwm];
System.arraycopy(data, 0, newData, 0, hwm);
return new ArrayIterator(newData);
|
public int | lastIndexOf(java.lang.Object o)
for (int i=hwm-1; i>=0; i--) {
if (o == data[i]) {
return i;
}
}
return -1;
|
public java.util.ListIterator | listIterator()
throw new IllegalStateException(
"listIterator method not implemented in IndexList");
|
public java.util.ListIterator | listIterator(int i)
throw new IllegalStateException(
"listIterator method not implemented in IndexList");
|
public boolean | remove(java.lang.Object o)remove() simply sets the given value to null.
int i;
if ((i = indexOf(o)) == -1)
return false;
remove(i);
return true;
|
public java.lang.Object | remove(int i)remove() simply sets the given value to null.
Object old = data[i];
data[i] = null;
return old;
|
public boolean | removeAll(java.util.Collection c)removeAll removes all the elements in a Collection from this List
NOT IMPLEMENTED.
throw new IllegalStateException(
"removeAll method not implemented in IndexList");
|
public boolean | retainAll(java.util.Collection c)
throw new IllegalStateException(
"removeAll method not implemented in IndexList");
|
public java.lang.Object | set(int i, java.lang.Object o)
ensureCapacity(i);
Object old = data[i];
data[i] = o;
return old;
|
public int | size()
return hwm;
|
public java.util.List | subList(int from, int to)
throw new IllegalStateException(
"subList method not implemented in IndexList");
|
public java.lang.Object[] | toArray()Return the collection as an Array of Object
return (Object[])data.clone();
|
public java.lang.Object[] | toArray(java.lang.Object[] newData)Return the collection as an Array of newData's type
if (newData.length != hwm) {
throw new IllegalArgumentException("newData length != current");
}
System.arraycopy(data, 0, newData, 0, hwm);
return newData;
|