Class LIFOQueue<E>

java.lang.Object
java.util.AbstractCollection
java.util.ArrayDeque
jmt.jmch.animation.customQueue.LIFOQueue<E>
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, Deque, Queue, SequencedCollection, CustomCollection

public class LIFOQueue<E> extends ArrayDeque implements CustomCollection
ArrayDeque that implements the CustomCollection interface, to act as a LIFO Queue
Author:
Lorenzo Torri Date: 25-mar-2024 Time: 13.32
See Also:
  • Constructor Details

    • LIFOQueue

      public LIFOQueue()
  • Method Details

    • addNew

      public boolean addNew(Object o)
      Description copied from interface: CustomCollection
      Add a new element to the Collection, how to add and where to add it, it will be handled by the classes that implements this interface
      Specified by:
      addNew in interface CustomCollection<E>
      Parameters:
      o - Object to add
      Returns:
      true if the adding was successful
    • removeHead

      public boolean removeHead()
      Description copied from interface: CustomCollection
      Remove the head of the Collection
      Specified by:
      removeHead in interface CustomCollection<E>
      Returns:
      true if the head is removed correctly
    • first

      public Object first()
      Description copied from interface: CustomCollection
      Retrieve the first element of the Collection
      Specified by:
      first in interface CustomCollection<E>
      Returns:
      the first element of the Collection, null otherwise
    • removeObject

      public boolean removeObject(Object e)
      Description copied from interface: CustomCollection
      Remove the Object o from the list. Used for specific cases like BoxStation in PS that has to remove the job from the queue
      Specified by:
      removeObject in interface CustomCollection<E>
      Parameters:
      e - the object
      Returns:
      true if it has removed the object correctly