common
Class ExtensibleLinkedList
java.lang.Object
java.util.AbstractCollection
common.ExtensibleLinkedList
- All Implemented Interfaces:
- java.lang.Iterable, java.util.Collection
public class ExtensibleLinkedList
- extends java.util.AbstractCollection
A data structure that is implemented as a linked list, but only
implements the Collection interface, so it does not allow random access
to elements and does not support ListIterators. However, the iterators
used in an ExtensibleLinkedList are very robust: the only thing that
invalidates an iterator is if some other piece of code (other than the
iterator's remove
method) removes the last element returned
by that iterator's next
method.
Constructor Summary |
ExtensibleLinkedList()
Creates an empty list. |
ExtensibleLinkedList(java.util.Collection c)
Creates a list containing the elements of the specified collection,
in the order they are returned by the collection's iterator. |
Method Summary |
boolean |
add(java.lang.Object o)
Adds the given object to the end of this list. |
java.util.Iterator |
iterator()
|
int |
size()
|
Methods inherited from class java.util.AbstractCollection |
addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Collection |
equals, hashCode |
ExtensibleLinkedList
public ExtensibleLinkedList()
- Creates an empty list.
ExtensibleLinkedList
public ExtensibleLinkedList(java.util.Collection c)
- Creates a list containing the elements of the specified collection,
in the order they are returned by the collection's iterator.
size
public int size()
- Specified by:
size
in interface java.util.Collection
- Specified by:
size
in class java.util.AbstractCollection
iterator
public java.util.Iterator iterator()
- Specified by:
iterator
in interface java.lang.Iterable
- Specified by:
iterator
in interface java.util.Collection
- Specified by:
iterator
in class java.util.AbstractCollection
add
public boolean add(java.lang.Object o)
- Adds the given object to the end of this list.
- Specified by:
add
in interface java.util.Collection
- Overrides:
add
in class java.util.AbstractCollection