| java.lang.Object org.apache.commons.collections.list.AbstractLinkedList
All known Subclasses: org.apache.commons.collections.list.CursorableLinkedList, org.apache.commons.collections.list.NodeCachingLinkedList,
AbstractLinkedList | abstract public class AbstractLinkedList implements List(Code) | | An abstract implementation of a linked list which provides numerous points for
subclasses to override.
Overridable methods are provided to change the storage node and to change how
nodes are added to and removed. Hopefully, all you need for unusual subclasses
is here.
since: Commons Collections 3.0 version: $Revision: 219343 $ $Date: 2005-07-16 18:08:16 +0100 (Sat, 16 Jul 2005) $ author: Rich Dougherty author: Phil Steitz author: Stephen Colebourne |
Inner Class :protected static class Node | |
Inner Class :protected static class LinkedSubListIterator extends LinkedListIterator | |
Inner Class :protected static class LinkedSubList extends AbstractList | |
Field Summary | |
protected transient Node | header A
Node which indicates the start and end of the list and does not
hold a value. | protected transient int | modCount | protected transient int | size |
Method Summary | |
public boolean | add(Object value) | public void | add(int index, Object value) | public boolean | addAll(Collection coll) | public boolean | addAll(int index, Collection coll) | public boolean | addFirst(Object o) | public boolean | addLast(Object o) | protected void | addNode(Node nodeToInsert, Node insertBeforeNode) Inserts a new node into the list. | protected void | addNodeAfter(Node node, Object value) Creates a new node with the specified object as its
value and inserts it after node . | protected void | addNodeBefore(Node node, Object value) Creates a new node with the specified object as its
value and inserts it before node . | public void | clear() | public boolean | contains(Object value) | public boolean | containsAll(Collection coll) | protected Node | createHeaderNode() Creates a new node with previous, next and element all set to null. | protected Node | createNode(Object value) Creates a new node with the specified properties. | protected Iterator | createSubListIterator(LinkedSubList subList) Creates an iterator for the sublist. | protected ListIterator | createSubListListIterator(LinkedSubList subList, int fromIndex) Creates a list iterator for the sublist. | protected void | doReadObject(ObjectInputStream inputStream) Deserializes the data held in this object to the stream specified. | protected void | doWriteObject(ObjectOutputStream outputStream) Serializes the data held in this object to the stream specified. | public boolean | equals(Object obj) | public Object | get(int index) | public Object | getFirst() | public Object | getLast() | protected Node | getNode(int index, boolean endMarkerAllowed) Gets the node at a particular index. | public int | hashCode() | public int | indexOf(Object value) | protected void | init() The equivalent of a default constructor, broken out so it can be called
by any constructor and by readObject . | public boolean | isEmpty() | protected boolean | isEqualValue(Object value1, Object value2) Compares two values for equals. | public Iterator | iterator() | public int | lastIndexOf(Object value) | public ListIterator | listIterator() | public ListIterator | listIterator(int fromIndex) | public Object | remove(int index) | public boolean | remove(Object value) | public boolean | removeAll(Collection coll) | protected void | removeAllNodes() Removes all nodes by resetting the circular list marker. | public Object | removeFirst() | public Object | removeLast() | protected void | removeNode(Node node) Removes the specified node from the list. | public boolean | retainAll(Collection coll) | public Object | set(int index, Object value) | public int | size() | public List | subList(int fromIndexInclusive, int toIndexExclusive) Gets a sublist of the main list. | public Object[] | toArray() | public Object[] | toArray(Object[] array) | public String | toString() | protected void | updateNode(Node node, Object value) Updates the node with a new value. |
header | protected transient Node header(Code) | | A
Node which indicates the start and end of the list and does not
hold a value. The value of next is the first item in the
list. The value of of previous is the last item in the list.
|
modCount | protected transient int modCount(Code) | | Modification count for iterators
|
size | protected transient int size(Code) | | The size of the list
|
AbstractLinkedList | protected AbstractLinkedList()(Code) | | Constructor that does nothing intended for deserialization.
If this constructor is used by a serializable subclass then the init()
method must be called.
|
AbstractLinkedList | protected AbstractLinkedList(Collection coll)(Code) | | Constructs a list copying data from the specified collection.
Parameters: coll - the collection to copy |
addNode | protected void addNode(Node nodeToInsert, Node insertBeforeNode)(Code) | | Inserts a new node into the list.
Parameters: nodeToInsert - new node to insert Parameters: insertBeforeNode - node to insert before throws: NullPointerException - if either node is null |
clear | public void clear()(Code) | | |
createHeaderNode | protected Node createHeaderNode()(Code) | | Creates a new node with previous, next and element all set to null.
This implementation creates a new empty Node.
Subclasses can override this to create a different class.
newly created node |
createNode | protected Node createNode(Object value)(Code) | | Creates a new node with the specified properties.
This implementation creates a new Node with data.
Subclasses can override this to create a different class.
Parameters: value - value of the new node |
createSubListIterator | protected Iterator createSubListIterator(LinkedSubList subList)(Code) | | Creates an iterator for the sublist.
Parameters: subList - the sublist to get an iterator for |
createSubListListIterator | protected ListIterator createSubListListIterator(LinkedSubList subList, int fromIndex)(Code) | | Creates a list iterator for the sublist.
Parameters: subList - the sublist to get an iterator for Parameters: fromIndex - the index to start from, relative to the sublist |
doWriteObject | protected void doWriteObject(ObjectOutputStream outputStream) throws IOException(Code) | | Serializes the data held in this object to the stream specified.
The first serializable subclass must call this method from
writeObject .
|
getNode | protected Node getNode(int index, boolean endMarkerAllowed) throws IndexOutOfBoundsException(Code) | | Gets the node at a particular index.
Parameters: index - the index, starting from 0 Parameters: endMarkerAllowed - whether or not the end marker can be returned ifstartIndex is set to the list's size throws: IndexOutOfBoundsException - if the index is less than 0; equal tothe size of the list and endMakerAllowed is false; or greater than thesize of the list |
hashCode | public int hashCode()(Code) | | |
init | protected void init()(Code) | | The equivalent of a default constructor, broken out so it can be called
by any constructor and by readObject .
Subclasses which override this method should make sure they call super,
so the list is initialised properly.
|
isEmpty | public boolean isEmpty()(Code) | | |
isEqualValue | protected boolean isEqualValue(Object value1, Object value2)(Code) | | Compares two values for equals.
This implementation uses the equals method.
Subclasses can override this to match differently.
Parameters: value1 - the first value to compare, may be null Parameters: value2 - the second value to compare, may be null true if equal |
removeAllNodes | protected void removeAllNodes()(Code) | | Removes all nodes by resetting the circular list marker.
|
removeNode | protected void removeNode(Node node)(Code) | | Removes the specified node from the list.
Parameters: node - the node to remove throws: NullPointerException - if node is null |
subList | public List subList(int fromIndexInclusive, int toIndexExclusive)(Code) | | Gets a sublist of the main list.
Parameters: fromIndexInclusive - the index to start from Parameters: toIndexExclusive - the index to end at the new sublist |
updateNode | protected void updateNode(Node node, Object value)(Code) | | Updates the node with a new value.
This implementation sets the value on the node.
Subclasses can override this to record the change.
Parameters: node - node to update Parameters: value - new value of the node |
|
|