Class NullSkippingLinkedList<E>

All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, Deque<E>, List<E>, Queue<E>

public class NullSkippingLinkedList<E> extends LinkedList<E>
LinkedList that ignores null on add / offer / push / deque head-tail inserts.
See Also:
  • Constructor Details

    • NullSkippingLinkedList

      public NullSkippingLinkedList()
    • NullSkippingLinkedList

      public NullSkippingLinkedList(Collection<? extends E> c)
  • Method Details

    • add

      public boolean add(E e)
      Appends a non-null element to the tail.
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface Deque<E>
      Specified by:
      add in interface List<E>
      Specified by:
      add in interface Queue<E>
      Overrides:
      add in class LinkedList<E>
      Parameters:
      e - element to append
      Returns:
      true if element was added; false for null
    • add

      public void add(int index, E element)
      Inserts a non-null element at the specified index.
      Specified by:
      add in interface List<E>
      Overrides:
      add in class LinkedList<E>
      Parameters:
      index - insertion index
      element - element to insert
    • addAll

      public boolean addAll(Collection<? extends E> c)
      Appends all non-null elements from the source collection.
      Specified by:
      addAll in interface Collection<E>
      Specified by:
      addAll in interface Deque<E>
      Specified by:
      addAll in interface List<E>
      Overrides:
      addAll in class LinkedList<E>
      Parameters:
      c - source collection
      Returns:
      true if at least one element was appended
    • addAll

      public boolean addAll(int index, Collection<? extends E> c)
      Inserts all non-null elements from the source collection starting at index.
      Specified by:
      addAll in interface List<E>
      Overrides:
      addAll in class LinkedList<E>
      Parameters:
      index - insertion start index
      c - source collection
      Returns:
      true if at least one element was inserted
    • addFirst

      public void addFirst(E e)
      Adds a non-null element to deque head.
      Specified by:
      addFirst in interface Deque<E>
      Overrides:
      addFirst in class LinkedList<E>
      Parameters:
      e - element to add
    • addLast

      public void addLast(E e)
      Adds a non-null element to deque tail.
      Specified by:
      addLast in interface Deque<E>
      Overrides:
      addLast in class LinkedList<E>
      Parameters:
      e - element to add
    • offer

      public boolean offer(E e)
      Offers a non-null element to queue tail.
      Specified by:
      offer in interface Deque<E>
      Specified by:
      offer in interface Queue<E>
      Overrides:
      offer in class LinkedList<E>
      Parameters:
      e - element to offer
      Returns:
      true if accepted; false for null
    • offerFirst

      public boolean offerFirst(E e)
      Offers a non-null element to deque head.
      Specified by:
      offerFirst in interface Deque<E>
      Overrides:
      offerFirst in class LinkedList<E>
      Parameters:
      e - element to offer
      Returns:
      true if accepted; false for null
    • offerLast

      public boolean offerLast(E e)
      Offers a non-null element to deque tail.
      Specified by:
      offerLast in interface Deque<E>
      Overrides:
      offerLast in class LinkedList<E>
      Parameters:
      e - element to offer
      Returns:
      true if accepted; false for null
    • push

      public void push(E e)
      Pushes a non-null element onto the stack view.
      Specified by:
      push in interface Deque<E>
      Overrides:
      push in class LinkedList<E>
      Parameters:
      e - element to push