Class 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 Detail

      • CircularList

        public CircularList()
    • 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 class java.lang.Object
      • main

        public static void main​(java.lang.String[] argv)