Package com.mchange.util.impl
Class CircularList
- java.lang.Object
-
- com.mchange.util.impl.CircularList
-
- All Implemented Interfaces:
java.lang.Cloneable
public class CircularList extends java.lang.Object implements java.lang.Cloneable
CircularList is a list class. Objects can be added at the beginning or end; they may be enumerated through forwards or backwards; they may be retrieved directly or by index from the front or rear. CircularLists can also be enumerated endlessly. If the list contains any elements at all, an "unterminated" Enumeration will always claim to have more elements... when it's done enumerating, it will start over again. The default Enumeration is of the usual, terminated variety, however.
This class is a completely UNSYNCHRONIZED implementation class. Synchronize on calls where necessary.
-
-
Constructor Summary
Constructors Constructor Description CircularList()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElementToFront(java.lang.Object object)
void
appendElement(java.lang.Object object)
java.lang.Object
clone()
Returns a shallow copy.java.util.Enumeration
elements()
java.util.Enumeration
elements(boolean forward)
java.util.Enumeration
elements(boolean forward, boolean terminated)
java.lang.Object
getElementFromBack(int index)
java.lang.Object
getElementFromFront(int index)
java.lang.Object
getFirstElement()
java.lang.Object
getLastElement()
static void
main(java.lang.String[] argv)
void
removeAllElements()
void
removeFirstElement()
void
removeFromBack(int count)
void
removeFromFront(int count)
void
removeLastElement()
int
size()
-
-
-
Method Detail
-
appendElement
public void appendElement(java.lang.Object object)
-
addElementToFront
public void addElementToFront(java.lang.Object object)
-
removeFirstElement
public void removeFirstElement()
-
removeLastElement
public void removeLastElement()
-
removeFromFront
public void removeFromFront(int count)
-
removeFromBack
public void removeFromBack(int count)
-
removeAllElements
public void removeAllElements()
-
getElementFromFront
public java.lang.Object getElementFromFront(int index)
-
getElementFromBack
public java.lang.Object getElementFromBack(int index)
-
getFirstElement
public java.lang.Object getFirstElement()
-
getLastElement
public java.lang.Object getLastElement()
-
elements
public java.util.Enumeration elements(boolean forward, boolean terminated)
-
elements
public java.util.Enumeration elements(boolean forward)
-
elements
public java.util.Enumeration elements()
-
size
public int size()
-
clone
public java.lang.Object clone()
Returns a shallow copy. The list is cloned, but not the elements within it.- Overrides:
clone
in classjava.lang.Object
-
main
public static void main(java.lang.String[] argv)
-
-