Class SafeLinkedList<T,E extends Supplier<T>>

java.lang.Object
icyllis.modernui.lifecycle.SafeLinkedList<T,E>
Type Parameters:
T - the token type
E - the element type, which is associated with the token
All Implemented Interfaces:
Iterable<E>
Direct Known Subclasses:
SafeLinkedHashMap

public class SafeLinkedList<T,E extends Supplier<T>> extends Object implements Iterable<E>
LinkedList, which pretends to be a map and supports modifications during iterations.
  • Constructor Details

    • SafeLinkedList

      public SafeLinkedList()
  • Method Details

    • find

      @Nullable protected icyllis.modernui.lifecycle.SafeLinkedList.Node<E> find(T token)
    • putIfAbsent

      public E putIfAbsent(@Nonnull E e)
      If the specified key is not already associated with a value, associates it with the given value.
      Parameters:
      e - value to be associated with the specified key
      Returns:
      the previous value associated with the specified key, or null if there was no mapping for the key
    • put

      protected icyllis.modernui.lifecycle.SafeLinkedList.Node<E> put(@Nonnull E e)
    • remove

      @Nullable public E remove(@Nonnull T key)
      Removes the mapping for a key from this map if it is present.
      Parameters:
      key - key whose mapping is to be removed from the map
      Returns:
      the previous value associated with the specified key, or null if there was no mapping for the key
    • size

      public int size()
      Returns:
      the number of elements in this map
    • iterator

      @Nonnull public Iterator<E> iterator()
      Specified by:
      iterator in interface Iterable<T>
      Returns:
      an ascending iterator, which doesn't include new elements added during an iteration.
    • descendingIterator

      @Nonnull public Iterator<E> descendingIterator()
      Returns:
      a descending iterator, which doesn't include new elements added during an iteration.
    • iteratorWithAdditions

      @Nonnull public Iterator<E> iteratorWithAdditions()
      return an iterator with additions.
    • head

      public E head()
      Returns:
      eldest added or null
    • tail

      public E tail()
      Returns:
      newest added or null
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object