Class DescendableLinkedList<E>

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

    public class DescendableLinkedList<E>
    extends java.util.LinkedList<E>
    Provides a descending iterator and other 1.6 methods to allow support on the 1.5 JRE.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      DescendableLinkedList()
      Create a new DescendableLinkedList.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Iterator<E> descendingIterator()
      Get an iterator that starts and the end of the list and works towards the start.
      E peekLast()
      Look at the last element, if there is one.
      E pollLast()
      Remove and return the last element, if there is one
      void push​(E e)
      Add a new element to the start of the list.
      • Methods inherited from class java.util.LinkedList

        add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, element, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, offer, offerFirst, offerLast, peek, peekFirst, poll, pollFirst, pop, remove, remove, remove, removeFirst, removeFirstOccurrence, removeLast, removeLastOccurrence, set, size, spliterator, toArray, toArray
      • Methods inherited from class java.util.AbstractSequentialList

        iterator
      • Methods inherited from class java.util.AbstractList

        equals, hashCode, listIterator, removeRange, subList
      • Methods inherited from class java.util.AbstractCollection

        containsAll, isEmpty, removeAll, retainAll, toString
      • 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.util.Deque

        iterator
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, replaceAll, retainAll, sort, subList
    • 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 java.util.Deque<E>
        Overrides:
        push in class java.util.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 java.util.Deque<E>
        Overrides:
        peekLast in class java.util.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 java.util.Deque<E>
        Overrides:
        pollLast in class java.util.LinkedList<E>
        Returns:
        the last element, or null
      • descendingIterator

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