Interface SmartDeque<E>

  • Type Parameters:
    E - element class.
    All Superinterfaces:
    Collection<E>, Iterable<E>, SmartCollection<E>

    public interface SmartDeque<E>
    extends SmartCollection<E>
    A double-ended queue (deque), allowing access, removal and insertion of elements both at the beginning and the end.
    • Method Detail

      • pushFront

        ElementReference pushFront​(E element)
        Adds an element at the beginning of the sequence.
        Parameters:
        element - the element to be added.
        Returns:
        the reference to the newly added element.
      • pushBack

        ElementReference pushBack​(E element)
        Adds an element at the end of the sequence.
        Parameters:
        element - the element to be added.
        Returns:
        the reference to the newly added element.
      • getFront

        E getFront()
        Retrieves the element at the beginning of the sequence, or null if the sequence is empty.
        Returns:
        the first element or null.
      • getBack

        E getBack()
        Retrieves the element at the end of the sequence, or null if the sequence is empty.
        Returns:
        the last element or null.
      • getFrontReference

        ElementReference getFrontReference()
        Retrieves the reference to the element at the beginning of the sequence, or null if the sequence is empty.
        Returns:
        reference to the first element or null.
      • getBackReference

        ElementReference getBackReference()
        Retrieves the reference to the element at the end of the sequence, or null if the sequence is empty.
        Returns:
        reference to the last element or null.
      • popFront

        E popFront()
        Retrieves and removes the element at the beginning of the sequence. If the sequence is empty, null is returned.
        Returns:
        the previously first element or null.
      • popBack

        E popBack()
        Retrieves and removes the element at the beginning of the sequence. If the sequence is empty, null is returned.
        Returns:
        the previously first element or null.