com.mchange.util.impl
Class CircularList
java.lang.Object
com.mchange.util.impl.CircularList
- All Implemented Interfaces:
- Cloneable
public class CircularList
- extends Object
- implements 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.
CircularList
public CircularList()
appendElement
public void appendElement(Object object)
addElementToFront
public void addElementToFront(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 Object getElementFromFront(int index)
getElementFromBack
public Object getElementFromBack(int index)
getFirstElement
public Object getFirstElement()
getLastElement
public Object getLastElement()
elements
public Enumeration elements(boolean forward,
boolean terminated)
elements
public Enumeration elements(boolean forward)
elements
public Enumeration elements()
size
public int size()
clone
public Object clone()
- Returns a shallow copy. The list is
cloned, but not the elements within it.
- Overrides:
clone
in class Object
main
public static void main(String[] argv)