Package com.tangosol.util
Class RecyclingLinkedList
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
com.tangosol.util.SafeLinkedList
com.tangosol.util.RecyclingLinkedList
- All Implemented Interfaces:
Serializable,Cloneable,Iterable,Collection,List,SequencedCollection
Extends SafeLinkedList and adds recycling of Node objects.
- Author:
- cp 2002.01.06
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intThe default maximum number of Nodes to recycle.protected RecyclingLinkedList.Node[]The Nodes to recycle.protected intThe maximum number of Nodes to recycle.protected intThe current number of Nodes being recycle.Fields inherited from class com.tangosol.util.SafeLinkedList
m_cNodes, m_current, m_head, m_iPos, m_tailFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty List.RecyclingLinkedList(int cMaxRecycle) Construct an empty List.RecyclingLinkedList(Collection collection) Construct a List containing the elements of the specified Collection.RecyclingLinkedList(Collection collection, int cMaxRecycle) Construct a List containing the elements of the specified Collection. -
Method Summary
Modifier and TypeMethodDescriptionclone()Create a deep clone of the list.protected voidinitRecycling(int cMaxRecycle) Initializing the recycling data structures.protected SafeLinkedList.NodeInstantiate a Node.protected voidRecycle the passed Node.Methods inherited from class com.tangosol.util.SafeLinkedList
add, add, addAll, addAll, clear, contains, containsAll, get, getFirst, getNode, indexOf, lastIndexOf, main, markPosition, remove, remove, removeFirst, reset, set, size, toArray, toArrayMethods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
isEmpty, removeAll, retainAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, equals, getLast, hashCode, isEmpty, iterator, listIterator, listIterator, removeAll, removeLast, replaceAll, retainAll, reversed, sort, spliterator, subList
-
Field Details
-
m_anodeRecycled
The Nodes to recycle. -
m_cRecycleNodes
protected transient int m_cRecycleNodesThe current number of Nodes being recycle. -
m_cRecycleMax
protected int m_cRecycleMaxThe maximum number of Nodes to recycle. -
DEFAULT_RECYCLE_MAX
protected static final int DEFAULT_RECYCLE_MAXThe default maximum number of Nodes to recycle.- See Also:
-
-
Constructor Details
-
RecyclingLinkedList
public RecyclingLinkedList()Construct an empty List. -
RecyclingLinkedList
public RecyclingLinkedList(int cMaxRecycle) Construct an empty List.- Parameters:
cMaxRecycle- the maximum number of Nodes to recycle at any given time
-
RecyclingLinkedList
Construct a List containing the elements of the specified Collection.- Parameters:
collection- the Collection to fill this List from
-
RecyclingLinkedList
Construct a List containing the elements of the specified Collection.- Parameters:
collection- the Collection to fill this List fromcMaxRecycle- the maximum number of Nodes to recycle at any given time
-
-
Method Details
-
initRecycling
protected void initRecycling(int cMaxRecycle) Initializing the recycling data structures.- Parameters:
cMaxRecycle- the maximum number of Nodes to recycle at any given time
-
instantiateNode
Instantiate a Node. (Factory pattern.) This method is over-ridden by inheriting implementations if the inheriting implementation extends the inner Node class.- Overrides:
instantiateNodein classSafeLinkedList- Parameters:
o- the value for the Node
-
recycleNode
Recycle the passed Node.- Parameters:
node- the Node object to recycle
-
clone
Create a deep clone of the list.- Overrides:
clonein classSafeLinkedList- Returns:
- a clone of this list
-