Class FIFOList<E>

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

    public final class FIFOList<E>
    extends Vector<E>
    implements 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
    • Constructor Detail

      • FIFOList

        public FIFOList()
        Creates an empty FIFOList.
      • FIFOList

        protected FIFOList​(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:
        NullPointerException - if the specified collection is null.
    • Method Detail

      • create

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

        public boolean offer​(E item)
        Constructs a vector.
        Specified by:
        offer in interface 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 Queue<E>
      • remove

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

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

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