|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jagatoo.util.lists.ChainedList<E>
public class ChainedList<E extends DoublyChainable<E>>
The ChainedList is a List implementation, that contains
DoublyChainable objects. This way it produces zero garbage, while
the LinkedList produces a lot of garbage and is therefore
unusable for gaming stuff.
| Constructor Summary | |
|---|---|
ChainedList()
|
|
ChainedList(java.util.Collection<? extends E> c)
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. |
|
| Method Summary | ||
|---|---|---|
boolean |
add(E o)
|
|
void |
add(int index,
E element)
|
|
boolean |
addAll(java.util.Collection<? extends E> c)
|
|
boolean |
addAll(int index,
java.util.Collection<? extends E> c)
|
|
void |
addHead(E o)
Inserts the given element at the beginning of this list. |
|
void |
append(E o)
Appends the given element to the end of this list. |
|
void |
clear()
|
|
ChainedList<E> |
clone()
Returns a shallow copy of this ChainedList. |
|
boolean |
contains(java.lang.Object o)
|
|
boolean |
containsAll(java.util.Collection<?> c)
|
|
E |
element()
|
|
E |
get(int index)
|
|
E |
getHead()
Returns the head of this ChainedList. |
|
E |
getTail()
Returns the tail of this ChainedList. |
|
int |
indexOf(java.lang.Object o)
|
|
boolean |
isEmpty()
|
|
java.util.Iterator<E> |
iterator()
|
|
int |
lastIndexOf(java.lang.Object o)
|
|
java.util.ListIterator<E> |
listIterator()
|
|
java.util.ListIterator<E> |
listIterator(int index)
|
|
boolean |
offer(E o)
|
|
E |
peek()
|
|
E |
poll()
|
|
E |
remove()
|
|
E |
remove(int index)
|
|
boolean |
remove(java.lang.Object o)
|
|
boolean |
removeAll(java.util.Collection<?> c)
|
|
E |
removeHead()
Removes and returns the first element from this list. |
|
E |
removeTail()
Removes and returns the last element from this list. |
|
boolean |
retainAll(java.util.Collection<?> c)
|
|
E |
set(int index,
E element)
|
|
int |
size()
|
|
java.util.List<E> |
subList(int fromIndex,
int toIndex)
|
|
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this list in the correct order. |
|
|
toArray(T[] a)
Returns an array containing all of the elements in this list in the correct order; the runtime type of the returned array is that of the specified array. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public ChainedList()
public ChainedList(java.util.Collection<? extends E> c)
c - the collection whose elements are to be placed into this list.
java.lang.NullPointerException - if the specified collection is null.| Method Detail |
|---|
public int size()
size in interface java.util.Collection<E extends DoublyChainable<E>>size in interface java.util.List<E extends DoublyChainable<E>>public boolean isEmpty()
isEmpty in interface java.util.Collection<E extends DoublyChainable<E>>isEmpty in interface java.util.List<E extends DoublyChainable<E>>public E getHead()
ChainedList.
public E getTail()
ChainedList.
public E removeHead()
java.util.NoSuchElementException - if this list is empty.public E removeTail()
java.util.NoSuchElementException - if this list is empty.public void addHead(E o)
o - the element to be inserted at the beginning of this list.public void append(E o)
o - the element to be inserted at the end of this list.public boolean add(E o)
add in interface java.util.Collection<E extends DoublyChainable<E>>add in interface java.util.List<E extends DoublyChainable<E>>
public void add(int index,
E element)
add in interface java.util.List<E extends DoublyChainable<E>>public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E extends DoublyChainable<E>>addAll in interface java.util.List<E extends DoublyChainable<E>>
public boolean addAll(int index,
java.util.Collection<? extends E> c)
addAll in interface java.util.List<E extends DoublyChainable<E>>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<E extends DoublyChainable<E>>remove in interface java.util.List<E extends DoublyChainable<E>>public E remove(int index)
remove in interface java.util.List<E extends DoublyChainable<E>>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<E extends DoublyChainable<E>>removeAll in interface java.util.List<E extends DoublyChainable<E>>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<E extends DoublyChainable<E>>retainAll in interface java.util.List<E extends DoublyChainable<E>>
public E set(int index,
E element)
set in interface java.util.List<E extends DoublyChainable<E>>public E get(int index)
get in interface java.util.List<E extends DoublyChainable<E>>public int indexOf(java.lang.Object o)
indexOf in interface java.util.List<E extends DoublyChainable<E>>public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.List<E extends DoublyChainable<E>>public void clear()
clear in interface java.util.Collection<E extends DoublyChainable<E>>clear in interface java.util.List<E extends DoublyChainable<E>>public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<E extends DoublyChainable<E>>contains in interface java.util.List<E extends DoublyChainable<E>>public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<E extends DoublyChainable<E>>containsAll in interface java.util.List<E extends DoublyChainable<E>>
public java.util.List<E> subList(int fromIndex,
int toIndex)
subList in interface java.util.List<E extends DoublyChainable<E>>public E peek()
peek in interface java.util.Queue<E extends DoublyChainable<E>>public E element()
element in interface java.util.Queue<E extends DoublyChainable<E>>public E poll()
poll in interface java.util.Queue<E extends DoublyChainable<E>>public E remove()
remove in interface java.util.Queue<E extends DoublyChainable<E>>public boolean offer(E o)
offer in interface java.util.Queue<E extends DoublyChainable<E>>public java.util.ListIterator<E> listIterator(int index)
listIterator in interface java.util.List<E extends DoublyChainable<E>>public java.util.ListIterator<E> listIterator()
listIterator in interface java.util.List<E extends DoublyChainable<E>>public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E extends DoublyChainable<E>>iterator in interface java.util.Collection<E extends DoublyChainable<E>>iterator in interface java.util.List<E extends DoublyChainable<E>>public ChainedList<E> clone()
clone in class java.lang.Objectpublic java.lang.Object[] toArray()
toArray in interface java.util.Collection<E extends DoublyChainable<E>>toArray in interface java.util.List<E extends DoublyChainable<E>>public <T> T[] toArray(T[] a)
If the list fits in the specified array with room to spare (i.e., the array has more elements than the list), the element in the array immediately following the end of the collection is set to null. This is useful in determining the length of the list only if the caller knows that the list does not contain any null elements.
toArray in interface java.util.Collection<E extends DoublyChainable<E>>toArray in interface java.util.List<E extends DoublyChainable<E>>a - the array into which the elements of the list are to
be stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose.
java.lang.ArrayStoreException - if the runtime type of a is not a
supertype of the runtime type of every element in this list.
java.lang.NullPointerException - if the specified array is null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||