Class FIFOList<E>

  • Type Parameters:
    E - the class of the elements of this list.
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.Queue<E>, java.util.RandomAccess

    public final class FIFOList<E>
    extends java.util.Vector<E>
    implements java.util.Queue<E>
    The FIFOList class represents a first-in-first-out (FIFO) stack of objects. The usual push and pop operations are provided, as well as a method to peek at the top item on the stack, a method to test for whether the stack is empty, and a method to search the stack for an item and discover how far it is from the top.

    When a stack is first created, it contains no items.

    Version:
    1.0
    Author:
    Ernst Reissner
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID  
      • Fields inherited from class java.util.Vector

        capacityIncrement, elementCount, elementData
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        FIFOList()
      Creates an empty FIFOList.
      protected FIFOList​(java.util.Collection<? extends E> coll)
      Constructs a vector containing the elements of the specified collection, in the order they are returned by the collection's iterator.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <E> FIFOList<E> create()  
      static <E> FIFOList<E> create​(java.util.Collection<? extends E> coll)  
      E element()  
      boolean offer​(E item)
      Constructs a vector.
      E peek()  
      E poll()  
      E remove()  
      • Methods inherited from class java.util.Vector

        add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, forEach, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, toString, trimToSize
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Queue

        add
    • Constructor Detail

      • FIFOList

        public FIFOList()
        Creates an empty FIFOList.
      • FIFOList

        protected FIFOList​(java.util.Collection<? extends E> coll)
        Constructs a vector containing the elements of the specified collection, in the order they are returned by the collection's iterator.
        Parameters:
        coll - the collection whose elements are to be placed into this FIFOList.
        Throws:
        java.lang.NullPointerException - if the specified collection is null.
    • Method Detail

      • create

        public static <E> FIFOList<E> create()
      • create

        public static <E> FIFOList<E> create​(java.util.Collection<? extends E> coll)
      • offer

        public boolean offer​(E item)
        Constructs a vector.
        Specified by:
        offer in interface java.util.Queue<E>
        Parameters:
        item - the element to insert.
        Returns:
        true since nothing can prevent the item from being inserted.
      • poll

        public E poll()
        Specified by:
        poll in interface java.util.Queue<E>
      • remove

        public E remove()
        Specified by:
        remove in interface java.util.Queue<E>
      • peek

        public E peek()
        Specified by:
        peek in interface java.util.Queue<E>
      • element

        public E element()
        Specified by:
        element in interface java.util.Queue<E>