|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.collections.CursorableLinkedList
public class CursorableLinkedList
A doubly-linked list implementation of the List interface,
supporting a ListIterator that allows concurrent modifications
to the underlying list.
Implements all of the optional List operations, the
stack/queue/dequeue operations available in LinkedList
and supports a ListIterator that allows concurrent modifications
to the underlying list (see cursor()).
Note that this implementation is not synchronized.
LinkedList,
Serialized Form| Nested Class Summary | |
|---|---|
class |
CursorableLinkedList.Cursor
Deprecated. |
| Field Summary | |
|---|---|
protected java.util.List |
_cursors
Deprecated. A list of the currently CursorableLinkedList.Cursors currently
open in this list. |
protected org.apache.commons.collections.CursorableLinkedList.Listable |
_head
Deprecated. A sentry node. |
protected int |
_modCount
Deprecated. Tracks the number of structural modifications to me. |
protected int |
_size
Deprecated. The number of elements in me. |
| Constructor Summary | |
|---|---|
CursorableLinkedList()
Deprecated. |
|
| Method Summary | |
|---|---|
void |
add(int index,
java.lang.Object element)
Deprecated. Inserts the specified element at the specified position in this list. |
boolean |
add(java.lang.Object o)
Deprecated. Appends the specified element to the end of this list. |
boolean |
addAll(java.util.Collection c)
Deprecated. Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. |
boolean |
addAll(int index,
java.util.Collection c)
Deprecated. Inserts all of the elements in the specified collection into this list at the specified position. |
boolean |
addFirst(java.lang.Object o)
Deprecated. Inserts the specified element at the beginning of this list. |
boolean |
addLast(java.lang.Object o)
Deprecated. Inserts the specified element at the end of this list. |
protected void |
broadcastListableChanged(org.apache.commons.collections.CursorableLinkedList.Listable elt)
Deprecated. Informs all of my registered cursors that the specified element was changed. |
protected void |
broadcastListableInserted(org.apache.commons.collections.CursorableLinkedList.Listable elt)
Deprecated. Informs all of my registered cursors that the specified element was just added to my list. |
protected void |
broadcastListableRemoved(org.apache.commons.collections.CursorableLinkedList.Listable elt)
Deprecated. Informs all of my registered cursors that the specified element was just removed from my list. |
void |
clear()
Deprecated. Removes all of the elements from this list. |
boolean |
contains(java.lang.Object o)
Deprecated. Returns true if this list contains the specified element. |
boolean |
containsAll(java.util.Collection c)
Deprecated. Returns true if this list contains all of the elements of the specified collection. |
CursorableLinkedList.Cursor |
cursor()
Deprecated. Returns a ListIterator for iterating through the
elements of this list. |
CursorableLinkedList.Cursor |
cursor(int i)
Deprecated. Returns a ListIterator for iterating through the
elements of this list, initialized such that
ListIterator.next() will return the element at
the specified index (if any) and ListIterator.previous()
will return the element immediately preceding it (if any). |
boolean |
equals(java.lang.Object o)
Deprecated. Compares the specified object with this list for equality. |
java.lang.Object |
get(int index)
Deprecated. Returns the element at the specified position in this list. |
java.lang.Object |
getFirst()
Deprecated. Returns the element at the beginning of this list. |
java.lang.Object |
getLast()
Deprecated. Returns the element at the end of this list. |
protected org.apache.commons.collections.CursorableLinkedList.Listable |
getListableAt(int index)
Deprecated. Returns the CursorableLinkedList.Listable
at the specified index. |
int |
hashCode()
Deprecated. Returns the hash code value for this list. |
int |
indexOf(java.lang.Object o)
Deprecated. Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. |
protected org.apache.commons.collections.CursorableLinkedList.Listable |
insertListable(org.apache.commons.collections.CursorableLinkedList.Listable before,
org.apache.commons.collections.CursorableLinkedList.Listable after,
java.lang.Object value)
Deprecated. Inserts a new value into my list, after the specified before element, and before the specified after element |
protected void |
invalidateCursors()
Deprecated. Informs all of my registered cursors that they are now invalid. |
boolean |
isEmpty()
Deprecated. Returns true if this list contains no elements. |
java.util.Iterator |
iterator()
Deprecated. Returns a fail-fast iterator. |
int |
lastIndexOf(java.lang.Object o)
Deprecated. Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. |
java.util.ListIterator |
listIterator()
Deprecated. Returns a fail-fast ListIterator. |
java.util.ListIterator |
listIterator(int index)
Deprecated. Returns a fail-fast ListIterator. |
protected void |
registerCursor(CursorableLinkedList.Cursor cur)
Deprecated. Registers a CursorableLinkedList.Cursor to be notified
of changes to this list. |
java.lang.Object |
remove(int index)
Deprecated. Removes the element at the specified position in this list (optional operation). |
boolean |
remove(java.lang.Object o)
Deprecated. Removes the first occurrence in this list of the specified element. |
boolean |
removeAll(java.util.Collection c)
Deprecated. Removes from this list all the elements that are contained in the specified collection. |
java.lang.Object |
removeFirst()
Deprecated. Removes the first element of this list, if any. |
java.lang.Object |
removeLast()
Deprecated. Removes the last element of this list, if any. |
protected void |
removeListable(org.apache.commons.collections.CursorableLinkedList.Listable elt)
Deprecated. Removes the given CursorableLinkedList.Listable
from my list. |
boolean |
retainAll(java.util.Collection c)
Deprecated. Retains only the elements in this list that are contained in the specified collection. |
java.lang.Object |
set(int index,
java.lang.Object element)
Deprecated. Replaces the element at the specified position in this list with the specified element. |
int |
size()
Deprecated. Returns the number of elements in this list. |
java.util.List |
subList(int i,
int j)
Deprecated. Returns a fail-fast sublist. |
java.lang.Object[] |
toArray()
Deprecated. Returns an array containing all of the elements in this list in proper sequence. |
java.lang.Object[] |
toArray(java.lang.Object[] a)
Deprecated. Returns an array containing all of the elements in this list in proper sequence; the runtime type of the returned array is that of the specified array. |
java.lang.String |
toString()
Deprecated. Returns a String representation of this list, suitable for debugging. |
protected void |
unregisterCursor(CursorableLinkedList.Cursor cur)
Deprecated. Removes a CursorableLinkedList.Cursor from
the set of cursors to be notified of changes to this list. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected transient int _size
protected transient org.apache.commons.collections.CursorableLinkedList.Listable _head
_head.next() points to the first element in the list,
_head.prev() to the last. Note that it is possible for
_head.next().prev() and _head.prev().next() to be
non-null, as when I am a sublist for some larger list.
Use == _head.next() and == _head.prev() to determine
if a given
CursorableLinkedList.Listable
is the first or last element in the list.
protected transient int _modCount
protected transient java.util.List _cursors
CursorableLinkedList.Cursors currently
open in this list.
| Constructor Detail |
|---|
public CursorableLinkedList()
| Method Detail |
|---|
public boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Listo - element to be appended to this list.
public void add(int index,
java.lang.Object element)
add in interface java.util.Listindex - 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 - if the index is out of range
(index < 0 || index > size()).public boolean addAll(java.util.Collection c)
Collection's Iterator. The behavior of this operation is
unspecified if the specified collection is modified while
the operation is in progress. (Note that this will occur if the
specified collection is this list, and it's nonempty.)
addAll in interface java.util.CollectionaddAll in interface java.util.Listc - collection whose elements are to be added to this list.
java.lang.ClassCastException - if the class of an element in the specified
collection prevents it from being added to this list.
java.lang.IllegalArgumentException - if some aspect of an element in the
specified collection prevents it from being added to this
list.
public boolean addAll(int index,
java.util.Collection c)
Collection's Iterator. The behavior of this operation is
unspecified if the specified collection is modified while the
operation is in progress. (Note that this will occur if the specified
collection is this list, and it's nonempty.)
addAll in interface java.util.Listindex - index at which to insert first element from the specified
collection.c - elements to be inserted into this list.
java.lang.ClassCastException - if the class of one of elements of the
specified collection prevents it from being added to this
list.
java.lang.IllegalArgumentException - if some aspect of one of elements of
the specified collection prevents it from being added to
this list.
java.lang.IndexOutOfBoundsException - if the index is out of range (index
< 0 || index > size()).public boolean addFirst(java.lang.Object o)
add(0,o)).
o - element to be prepended to this list.
public boolean addLast(java.lang.Object o)
add(java.lang.Object)).
o - element to be appended to this list.
public void clear()
clear in interface java.util.Collectionclear in interface java.util.Listpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Listo - element whose presence in this list is to be tested.
public boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Listc - collection to be checked for containment in this list.
public CursorableLinkedList.Cursor cursor()
ListIterator for iterating through the
elements of this list. Unlike iterator(), a cursor
is not bothered by concurrent modifications to the
underlying list.
Specifically, when elements are added to the list before or
after the cursor, the cursor simply picks them up automatically.
When the "current" (i.e., last returned by ListIterator.next()
or ListIterator.previous()) element of the list is removed,
the cursor automatically adjusts to the change (invalidating the
last returned value--i.e., it cannot be removed).
Note that the returned ListIterator does not support the
ListIterator.nextIndex() and ListIterator.previousIndex()
methods (they throw UnsupportedOperationException when invoked.
Historical Note: In previous versions of this class, the object returned from this method was required to be explicitly closed. This is no longer necessary.
cursor(int),
listIterator(),
CursorableLinkedList.Cursorpublic CursorableLinkedList.Cursor cursor(int i)
ListIterator for iterating through the
elements of this list, initialized such that
ListIterator.next() will return the element at
the specified index (if any) and ListIterator.previous()
will return the element immediately preceding it (if any).
Unlike iterator(), a cursor
is not bothered by concurrent modifications to the
underlying list.
java.lang.IndexOutOfBoundsException - if the index is out of range (index
< 0 || index > size()).cursor(),
listIterator(int),
CursorableLinkedList.Cursorpublic boolean equals(java.lang.Object o)
equals in interface java.util.Collectionequals in interface java.util.Listequals in class java.lang.Objecto - the object to be compared for equality with this list.
public java.lang.Object get(int index)
get in interface java.util.Listindex - index of element to return.
java.lang.IndexOutOfBoundsException - if the index is out of range (index
< 0 || index >= size()).public java.lang.Object getFirst()
public java.lang.Object getLast()
public int hashCode()
hashCode = 1;
Iterator i = list.iterator();
while (i.hasNext()) {
Object obj = i.next();
hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
}
This ensures that list1.equals(list2) implies that
list1.hashCode()==list2.hashCode() for any two lists,
list1 and list2, as required by the general
contract of Object.hashCode.
hashCode in interface java.util.CollectionhashCode in interface java.util.ListhashCode in class java.lang.ObjectObject.hashCode(),
Object.equals(Object),
equals(Object)public int indexOf(java.lang.Object o)
indexOf in interface java.util.Listo - element to search for.
public boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Listpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.ListList.iterator()public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.Listo - element to search for.
public java.util.ListIterator listIterator()
listIterator in interface java.util.ListList.listIterator()public java.util.ListIterator listIterator(int index)
listIterator in interface java.util.ListList.listIterator(int)public boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Listo - element to be removed from this list, if present.
public java.lang.Object remove(int index)
remove in interface java.util.Listindex - the index of the element to removed.
java.lang.IndexOutOfBoundsException - if the index is out of range (index
< 0 || index >= size()).public boolean removeAll(java.util.Collection c)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Listc - collection that defines which elements will be removed from
this list.
public java.lang.Object removeFirst()
public java.lang.Object removeLast()
public boolean retainAll(java.util.Collection c)
retainAll in interface java.util.CollectionretainAll in interface java.util.Listc - collection that defines which elements this set will retain.
public java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.Listindex - 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 index is out of range
(index < 0 || index >= size()).public int size()
size in interface java.util.Collectionsize in interface java.util.Listpublic java.lang.Object[] toArray()
Collection.toArray() method.
toArray in interface java.util.CollectiontoArray in interface java.util.Listpublic java.lang.Object[] toArray(java.lang.Object[] a)
Collection.toArray() method.
toArray in interface java.util.CollectiontoArray in interface java.util.Lista - the array into which the elements of this 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 the specified array
is not a supertype of the runtime type of every element in
this list.public java.lang.String toString()
String representation of this list, suitable for debugging.
toString in class java.lang.ObjectString representation of this list, suitable for debugging.
public java.util.List subList(int i,
int j)
subList in interface java.util.ListList.subList(int,int)
protected org.apache.commons.collections.CursorableLinkedList.Listable insertListable(org.apache.commons.collections.CursorableLinkedList.Listable before,
org.apache.commons.collections.CursorableLinkedList.Listable after,
java.lang.Object value)
CursorableLinkedList.Listableprotected void removeListable(org.apache.commons.collections.CursorableLinkedList.Listable elt)
CursorableLinkedList.Listable
from my list.
protected org.apache.commons.collections.CursorableLinkedList.Listable getListableAt(int index)
CursorableLinkedList.Listable
at the specified index.
java.lang.IndexOutOfBoundsException - if index is less than zero or
greater than or equal to the size of this list.protected void registerCursor(CursorableLinkedList.Cursor cur)
CursorableLinkedList.Cursor to be notified
of changes to this list.
protected void unregisterCursor(CursorableLinkedList.Cursor cur)
CursorableLinkedList.Cursor from
the set of cursors to be notified of changes to this list.
protected void invalidateCursors()
protected void broadcastListableChanged(org.apache.commons.collections.CursorableLinkedList.Listable elt)
set(int,java.lang.Object)protected void broadcastListableRemoved(org.apache.commons.collections.CursorableLinkedList.Listable elt)
protected void broadcastListableInserted(org.apache.commons.collections.CursorableLinkedList.Listable elt)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||