Class DescendableLinkedList<E>

    • Constructor Detail

      • DescendableLinkedList

        public DescendableLinkedList()
        Create a new DescendableLinkedList.
    • Method Detail

      • push

        public void push​(E e)
        Add a new element to the start of the list.
        Specified by:
        push in interface Deque<E>
        Overrides:
        push in class LinkedList<E>
        Parameters:
        e - element to add
      • peekLast

        public E peekLast()
        Look at the last element, if there is one.
        Specified by:
        peekLast in interface Deque<E>
        Overrides:
        peekLast in class LinkedList<E>
        Returns:
        the last element, or null
      • pollLast

        public E pollLast()
        Remove and return the last element, if there is one
        Specified by:
        pollLast in interface Deque<E>
        Overrides:
        pollLast in class LinkedList<E>
        Returns:
        the last element, or null
      • descendingIterator

        public Iterator<E> descendingIterator()
        Get an iterator that starts and the end of the list and works towards the start.
        Specified by:
        descendingIterator in interface Deque<E>
        Overrides:
        descendingIterator in class LinkedList<E>
        Returns:
        an iterator that starts and the end of the list and works towards the start.