|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
com.tangosol.util.SafeLinkedList
public class SafeLinkedList
Implementation of the Collection Framework interface "List" using a linked list algorithm. Read-only operations avoid synchronizing. Some operations appear to be read-only but have side-effects, such as indexed operations against the List, because the List caches the last index used and the Node that it located (to facilitate processes that access the list sequentially using indexes etc.). Other operations, even if read-only, require the data structures to remain unchanged for the duration of the call to avoid potential exceptions (such as a NullPointerException if a reference is cleared).
| Nested Class Summary | |
|---|---|
protected static class |
SafeLinkedList.NodeA Node in the List. |
| Field Summary | |
|---|---|
protected int |
m_cNodesThe size of the List. |
protected SafeLinkedList.Node |
m_currentThe Node at the "cached position" in the List. |
protected SafeLinkedList.Node |
m_headThe first Node in the List (or null if empty). |
protected int |
m_iPosThe "cached position" in the List. |
protected SafeLinkedList.Node |
m_tailThe last Node in the List (or null if empty). |
| Fields inherited from class java.util.AbstractList |
|---|
modCount |
| Constructor Summary | |
|---|---|
SafeLinkedList()Construct an empty List. |
|
SafeLinkedList(java.util.Collection collection)Construct a List containing the elements of the specified Collection. |
|
| Method Summary | |
|---|---|
void |
add(int i, java.lang.Object o)Inserts the specified element at the specified position in this List. |
boolean |
add(java.lang.Object o)Appends the specified element to the end of this List. |
boolean |
addAll(java.util.Collection collection)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 i, java.util.Collection collection)Inserts all of the elements in the specified collection at the specified location in this List. |
void |
clear()Removes all of the elements from this List. |
java.lang.Object |
clone()Create a clone of the SafeLinkedList. |
boolean |
contains(java.lang.Object o)Returns true if this List contains the specified element. |
boolean |
containsAll(java.util.Collection collection)Returns true if this List contains all of the elements of the specified collection. |
java.lang.Object |
get(int i)Returns the element at the specified position in this List. |
java.lang.Object |
getFirst()Returns the first element in the list, or null if empty. |
protected SafeLinkedList.Node |
getNode(int i)Find and return the specified Node. |
int |
indexOf(java.lang.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. |
protected SafeLinkedList.Node |
instantiateNode(java.lang.Object o)Instantiate a Node. |
int |
lastIndexOf(java.lang.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. |
static void |
main(java.lang.String[] asArg)Self-test for SafeLinkedList. |
protected void |
markPosition(int i, SafeLinkedList.Node node)Remember that a certain Node occurs at a certain index. |
java.lang.Object |
remove(int i)Removes the element at the specified position in this List. |
boolean |
remove(java.lang.Object o)Removes the first occurrence in this List of the specified element. |
java.lang.Object |
removeFirst()Removes and returns the first element in the list. |
protected void |
reset()Completely reset the state of the List. |
java.lang.Object |
set(int i, java.lang.Object o)Replaces the element at the specified position in this List with the specified element. |
int |
size()Returns the number of elements in this List. |
java.lang.Object[] |
toArray()Returns an array containing all of the elements in this List in the order that the elements occur in the List. |
java.lang.Object[] |
toArray(java.lang.Object[] a)Returns an array with a runtime type is that of the specified array and that contains all of the elements in this List. |
| Methods inherited from class java.util.AbstractList |
|---|
equals, hashCode, iterator, listIterator, listIterator, removeRange, subList |
| Methods inherited from class java.util.AbstractCollection |
|---|
isEmpty, removeAll, retainAll, toString |
| Methods inherited from interface java.util.List |
|---|
equals, hashCode, isEmpty, iterator, listIterator, listIterator, removeAll, retainAll, subList |
| Field Detail |
|---|
protected SafeLinkedList.Node m_head
protected SafeLinkedList.Node m_tail
protected volatile int m_cNodes
protected transient int m_iPos
protected transient SafeLinkedList.Node m_current
| Constructor Detail |
|---|
public SafeLinkedList()
public SafeLinkedList(java.util.Collection collection)
collection - the Collection to fill this List from| Method Detail |
|---|
public int size()
synchronized(list) { int c = list.size() ... }
size in interface java.util.Collectionsize in interface java.util.Listsize in class java.util.AbstractCollectionpublic boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Listadd in class java.util.AbstractListo - element to be appended to this Listpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Listremove in class java.util.AbstractCollectiono - element to be removed from this List, if presentpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Listcontains in class java.util.AbstractCollectiono - element whose presence in this List is to be testedpublic boolean containsAll(java.util.Collection collection)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.ListcontainsAll in class java.util.AbstractCollectioncollection - collection to be checked for containment in this Listpublic int indexOf(java.lang.Object o)
indexOf in interface java.util.ListindexOf in class java.util.AbstractListo - element to search for.public int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.ListlastIndexOf in class java.util.AbstractListo - element to search for.
public void add(int i,
java.lang.Object o)
add in interface java.util.Listadd in class java.util.AbstractListi - the index at which to insert the specified elemento - element to be insertedjava.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size()).public java.lang.Object remove(int i)
remove in interface java.util.Listremove in class java.util.AbstractListi - the index of the element to removedjava.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).public java.lang.Object removeFirst()
public java.lang.Object get(int i)
get in interface java.util.Listget in class java.util.AbstractListi - the index of the element to returnjava.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).public java.lang.Object getFirst()
public java.lang.Object set(int i,
java.lang.Object o)
set in interface java.util.Listset in class java.util.AbstractListi - the index of the element to replaceo - the value to be stored at the specified positionjava.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
public boolean addAll(int i,
java.util.Collection collection)
addAll in interface java.util.ListaddAll in class java.util.AbstractListi - the index at which insertion will occurcollection - a collection whose elements are to be inserted into this Listjava.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size()).public boolean addAll(java.util.Collection collection)
addAll in interface java.util.CollectionaddAll in interface java.util.ListaddAll in class java.util.AbstractCollectioncollection - a collection whose elements are to be added to this Listpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Listclear in class java.util.AbstractListpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.ListtoArray in class java.util.AbstractCollectionpublic java.lang.Object[] toArray(java.lang.Object[] 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 last element 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.CollectiontoArray in interface java.util.ListtoArray in class java.util.AbstractCollectiona - 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 purposejava.lang.ArrayStoreException - if the runtime type of the specified array is not a supertype of the runtime type of every element in this Listpublic java.lang.Object clone()
protected void markPosition(int i,
SafeLinkedList.Node node)
i - the index; the marker is updated only if the index is greater than zero and less than size() - 1node - the Nodeprotected void reset()
protected SafeLinkedList.Node instantiateNode(java.lang.Object o)
o - the value for the Nodeprotected SafeLinkedList.Node getNode(int i)
i - the Node indexjava.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index > size()).
public static void main(java.lang.String[] asArg)
throws java.lang.Exception
java.lang.Exception
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||