Java Doc for CursorableLinkedList.java in  » Library » Apache-common-Collections » org » apache » commons » collections » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache common Collections » org.apache.commons.collections 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.collections.CursorableLinkedList

CursorableLinkedList
public class CursorableLinkedList implements List,Serializable(Code)
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 java.util.LinkedList and supports a ListIterator that allows concurrent modifications to the underlying list (see CursorableLinkedList.cursor ).

Note that this implementation is not synchronized.
See Also:   java.util.LinkedList
since:
   Commons Collections 1.0
version:
   $Revision: 404858 $ $Date: 2006-05-07 22:40:39 +0100 (Sun, 07 May 2006) $
author:
   Rodney Waldhoff
author:
   Janek Bogucki
author:
   Simon Kitching


Inner Class :static class Listable implements Serializable
Inner Class :class ListIter implements ListIterator
Inner Class :public class Cursor extends ListIter implements ListIterator

Field Summary
protected transient  List_cursors
     A list of the currently CursorableLinkedList.Cursor s currently open in this list.
protected transient  Listable_head
     A sentry node.

_head.next() points to the first element in the list, _head.prev() to the last.

protected transient  int_modCount
     Tracks the number of structural modifications to me.
protected transient  int_size
     The number of elements in me.


Method Summary
public  booleanadd(Object o)
     Appends the specified element to the end of this list.
Parameters:
  o - element to be appended to this list.
public  voidadd(int index, Object element)
     Inserts the specified element at the specified position in this list.
public  booleanaddAll(Collection c)
     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 .
public  booleanaddAll(int index, Collection c)
     Inserts all of the elements in the specified collection into this list at the specified position.
public  booleanaddFirst(Object o)
     Inserts the specified element at the beginning of this list. (Equivalent to CursorableLinkedList.add(int,java.lang.Object) add(0,o) ).
Parameters:
  o - element to be prepended to this list.
public  booleanaddLast(Object o)
     Inserts the specified element at the end of this list. (Equivalent to CursorableLinkedList.add(java.lang.Object) ).
Parameters:
  o - element to be appended to this list.
protected  voidbroadcastListableChanged(Listable elt)
     Informs all of my registered cursors that the specified element was changed.
protected  voidbroadcastListableInserted(Listable elt)
     Informs all of my registered cursors that the specified element was just added to my list.
protected  voidbroadcastListableRemoved(Listable elt)
     Informs all of my registered cursors that the specified element was just removed from my list.
public  voidclear()
     Removes all of the elements from this list.
public  booleancontains(Object o)
     Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).
Parameters:
  o - element whose presence in this list is to be tested.
public  booleancontainsAll(Collection c)
     Returns true if this list contains all of the elements of the specified collection.
Parameters:
  c - collection to be checked for containment in this list.
public  CursorableLinkedList.Cursorcursor()
     Returns a ListIterator for iterating through the elements of this list.
public  CursorableLinkedList.Cursorcursor(int i)
     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).
public  booleanequals(Object o)
     Compares the specified object with this list for equality.
public  Objectget(int index)
     Returns the element at the specified position in this list.
Parameters:
  index - index of element to return.
public  ObjectgetFirst()
     Returns the element at the beginning of this list.
public  ObjectgetLast()
     Returns the element at the end of this list.
protected  ListablegetListableAt(int index)
     Returns the org.apache.commons.collections.CursorableLinkedList.Listable at the specified index.
public  inthashCode()
     Returns the hash code value for this list.
public  intindexOf(Object o)
     Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
  o - element to search for.
protected  ListableinsertListable(Listable before, Listable after, Object value)
    
protected  voidinvalidateCursors()
     Informs all of my registered cursors that they are now invalid.
public  booleanisEmpty()
     Returns true if this list contains no elements.
public  Iteratoriterator()
     Returns a fail-fast iterator.
public  intlastIndexOf(Object o)
     Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
  o - element to search for.
public  ListIteratorlistIterator()
     Returns a fail-fast ListIterator.
public  ListIteratorlistIterator(int index)
     Returns a fail-fast ListIterator.
protected  voidregisterCursor(Cursor cur)
     Registers a CursorableLinkedList.Cursor to be notified of changes to this list.
public  booleanremove(Object o)
     Removes the first occurrence in this list of the specified element. If this list does not contain the element, it is unchanged.
public  Objectremove(int index)
     Removes the element at the specified position in this list (optional operation).
public  booleanremoveAll(Collection c)
     Removes from this list all the elements that are contained in the specified collection.
Parameters:
  c - collection that defines which elements will be removed fromthis list.
public  ObjectremoveFirst()
     Removes the first element of this list, if any.
public  ObjectremoveLast()
     Removes the last element of this list, if any.
protected  voidremoveListable(Listable elt)
     Removes the given org.apache.commons.collections.CursorableLinkedList.Listable from my list.
public  booleanretainAll(Collection c)
     Retains only the elements in this list that are contained in the specified collection.
public  Objectset(int index, Object element)
     Replaces the element at the specified position in this list with the specified element.
Parameters:
  index - index of element to replace.
Parameters:
  element - element to be stored at the specified position.
public  intsize()
     Returns the number of elements in this list.
public  ListsubList(int i, int j)
     Returns a fail-fast sublist.
public  Object[]toArray()
     Returns an array containing all of the elements in this list in proper sequence.
public  Object[]toArray(Object a)
     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.
public  StringtoString()
     Returns a String representation of this list, suitable for debugging.
protected  voidunregisterCursor(Cursor cur)
     Removes a CursorableLinkedList.Cursor from the set of cursors to be notified of changes to this list.

Field Detail
_cursors
protected transient List _cursors(Code)
A list of the currently CursorableLinkedList.Cursor s currently open in this list.



_head
protected transient Listable _head(Code)
A sentry node.

_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 org.apache.commons.collections.CursorableLinkedList.Listable is the first or last element in the list.




_modCount
protected transient int _modCount(Code)
Tracks the number of structural modifications to me.



_size
protected transient int _size(Code)
The number of elements in me.





Method Detail
add
public boolean add(Object o)(Code)
Appends the specified element to the end of this list.
Parameters:
  o - element to be appended to this list. true



add
public void add(int index, Object element)(Code)
Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
Parameters:
  index - index at which the specified element is to be inserted.
Parameters:
  element - element to be inserted.
throws:
  ClassCastException - if the class of the specified elementprevents it from being added to this list.
throws:
  IllegalArgumentException - if some aspect of the specifiedelement prevents it from being added to this list.
throws:
  IndexOutOfBoundsException - if the index is out of range(index < 0 || index > size()).



addAll
public boolean addAll(Collection c)(Code)
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 . 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.)
Parameters:
  c - collection whose elements are to be added to this list. true if this list changed as a result of the call.
throws:
  ClassCastException - if the class of an element in the specifiedcollection prevents it from being added to this list.
throws:
  IllegalArgumentException - if some aspect of an element in thespecified collection prevents it from being added to thislist.



addAll
public boolean addAll(int index, Collection c)(Code)
Inserts all of the elements in the specified collection into this list at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified 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.)
Parameters:
  index - index at which to insert first element from the specifiedcollection.
Parameters:
  c - elements to be inserted into this list. true if this list changed as a result of the call.
throws:
  ClassCastException - if the class of one of elements of thespecified collection prevents it from being added to thislist.
throws:
  IllegalArgumentException - if some aspect of one of elements ofthe specified collection prevents it from being added tothis list.
throws:
  IndexOutOfBoundsException - if the index is out of range (index< 0 || index > size()).



addFirst
public boolean addFirst(Object o)(Code)
Inserts the specified element at the beginning of this list. (Equivalent to CursorableLinkedList.add(int,java.lang.Object) add(0,o) ).
Parameters:
  o - element to be prepended to this list. true



addLast
public boolean addLast(Object o)(Code)
Inserts the specified element at the end of this list. (Equivalent to CursorableLinkedList.add(java.lang.Object) ).
Parameters:
  o - element to be appended to this list. true



broadcastListableChanged
protected void broadcastListableChanged(Listable elt)(Code)
Informs all of my registered cursors that the specified element was changed.
See Also:   CursorableLinkedList.set(int,java.lang.Object)



broadcastListableInserted
protected void broadcastListableInserted(Listable elt)(Code)
Informs all of my registered cursors that the specified element was just added to my list.



broadcastListableRemoved
protected void broadcastListableRemoved(Listable elt)(Code)
Informs all of my registered cursors that the specified element was just removed from my list.



clear
public void clear()(Code)
Removes all of the elements from this list. This list will be empty after this call returns (unless it throws an exception).



contains
public boolean contains(Object o)(Code)
Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).
Parameters:
  o - element whose presence in this list is to be tested. true if this list contains the specified element.



containsAll
public boolean containsAll(Collection c)(Code)
Returns true if this list contains all of the elements of the specified collection.
Parameters:
  c - collection to be checked for containment in this list. true if this list contains all of the elements of thespecified collection.



cursor
public CursorableLinkedList.Cursor cursor()(Code)
Returns a ListIterator for iterating through the elements of this list. Unlike CursorableLinkedList.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.
See Also:   CursorableLinkedList.cursor(int)
See Also:   CursorableLinkedList.listIterator
See Also:   CursorableLinkedList.Cursor




cursor
public CursorableLinkedList.Cursor cursor(int i)(Code)
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). Unlike CursorableLinkedList.iterator , a cursor is not bothered by concurrent modifications to the underlying list.
See Also:   CursorableLinkedList.cursor
See Also:   CursorableLinkedList.listIterator(int)
See Also:   CursorableLinkedList.Cursor
throws:
  IndexOutOfBoundsException - if the index is out of range (index< 0 || index > size()).



equals
public boolean equals(Object o)(Code)
Compares the specified object with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two lists are defined to be equal if they contain the same elements in the same order. This definition ensures that the equals method works properly across different implementations of the List interface.
Parameters:
  o - the object to be compared for equality with this list. true if the specified object is equal to this list.



get
public Object get(int index)(Code)
Returns the element at the specified position in this list.
Parameters:
  index - index of element to return. the element at the specified position in this list.
throws:
  IndexOutOfBoundsException - if the index is out of range (index< 0 || index >= size()).



getFirst
public Object getFirst()(Code)
Returns the element at the beginning of this list.



getLast
public Object getLast()(Code)
Returns the element at the end of this list.



getListableAt
protected Listable getListableAt(int index)(Code)
Returns the org.apache.commons.collections.CursorableLinkedList.Listable at the specified index.
throws:
  IndexOutOfBoundsException - if index is less than zero orgreater than or equal to the size of this list.



hashCode
public int hashCode()(Code)
Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:
 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. the hash code value for this list.
See Also:   Object.hashCode
See Also:   Object.equals(Object)
See Also:   CursorableLinkedList.equals(Object)



indexOf
public int indexOf(Object o)(Code)
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
  o - element to search for. the index in this list of the first occurrence of the specifiedelement, or -1 if this list does not contain this element.



insertListable
protected Listable insertListable(Listable before, Listable after, Object value)(Code)
Inserts a new value into my list, after the specified before element, and before the specified after element the newly created org.apache.commons.collections.CursorableLinkedList.Listable



invalidateCursors
protected void invalidateCursors()(Code)
Informs all of my registered cursors that they are now invalid.



isEmpty
public boolean isEmpty()(Code)
Returns true if this list contains no elements. true if this list contains no elements.



iterator
public Iterator iterator()(Code)
Returns a fail-fast iterator.
See Also:   List.iterator



lastIndexOf
public int lastIndexOf(Object o)(Code)
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
Parameters:
  o - element to search for. the index in this list of the last occurrence of the specifiedelement, or -1 if this list does not contain this element.



listIterator
public ListIterator listIterator()(Code)
Returns a fail-fast ListIterator.
See Also:   List.listIterator



listIterator
public ListIterator listIterator(int index)(Code)
Returns a fail-fast ListIterator.
See Also:   List.listIterator(int)



registerCursor
protected void registerCursor(Cursor cur)(Code)
Registers a CursorableLinkedList.Cursor to be notified of changes to this list.



remove
public boolean remove(Object o)(Code)
Removes the first occurrence in this list of the specified element. If this list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an element exists).
Parameters:
  o - element to be removed from this list, if present. true if this list contained the specified element.



remove
public Object remove(int index)(Code)
Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
Parameters:
  index - the index of the element to removed. the element previously at the specified position.
throws:
  IndexOutOfBoundsException - if the index is out of range (index< 0 || index >= size()).



removeAll
public boolean removeAll(Collection c)(Code)
Removes from this list all the elements that are contained in the specified collection.
Parameters:
  c - collection that defines which elements will be removed fromthis list. true if this list changed as a result of the call.



removeFirst
public Object removeFirst()(Code)
Removes the first element of this list, if any.



removeLast
public Object removeLast()(Code)
Removes the last element of this list, if any.



removeListable
protected void removeListable(Listable elt)(Code)
Removes the given org.apache.commons.collections.CursorableLinkedList.Listable from my list.



retainAll
public boolean retainAll(Collection c)(Code)
Retains only the elements in this list that are contained in the specified collection. In other words, removes from this list all the elements that are not contained in the specified collection.
Parameters:
  c - collection that defines which elements this set will retain. true if this list changed as a result of the call.



set
public Object set(int index, Object element)(Code)
Replaces the element at the specified position in this list with the specified element.
Parameters:
  index - index of element to replace.
Parameters:
  element - element to be stored at the specified position. the element previously at the specified position.
throws:
  ClassCastException - if the class of the specified elementprevents it from being added to this list.
throws:
  IllegalArgumentException - if some aspect of the specifiedelement prevents it from being added to this list.
throws:
  IndexOutOfBoundsException - if the index is out of range(index < 0 || index >= size()).



size
public int size()(Code)
Returns the number of elements in this list. the number of elements in this list.



subList
public List subList(int i, int j)(Code)
Returns a fail-fast sublist.
See Also:   List.subList(intint)



toArray
public Object[] toArray()(Code)
Returns an array containing all of the elements in this list in proper sequence. Obeys the general contract of the Collection.toArray method. an array containing all of the elements in this list in propersequence.



toArray
public Object[] toArray(Object a)(Code)
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. Obeys the general contract of the Collection.toArray method.
Parameters:
  a - the array into which the elements of this list are tobe stored, if it is big enough; otherwise, a new array of thesame runtime type is allocated for this purpose. an array containing the elements of this list.
exception:
  ArrayStoreException - if the runtime type of the specified arrayis not a supertype of the runtime type of every element inthis list.



toString
public String toString()(Code)
Returns a String representation of this list, suitable for debugging. a String representation of this list, suitable for debugging.



unregisterCursor
protected void unregisterCursor(Cursor cur)(Code)
Removes a CursorableLinkedList.Cursor from the set of cursors to be notified of changes to this list.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.