Class PairLists.MutablePairList<T,U>

Type Parameters:
T - First type
U - Second type
All Implemented Interfaces:
Iterable<Map.Entry<T,U>>, Collection<Map.Entry<T,U>>, List<Map.Entry<T,U>>, SequencedCollection<Map.Entry<T,U>>, PairList<T,U>
Enclosing class:
PairLists

static class PairLists.MutablePairList<T,U> extends PairLists.AbstractPairList<T,U>
Mutable version of PairList.
  • Field Details

  • Constructor Details

    • MutablePairList

      MutablePairList(List<@Nullable Object> list)
  • Method Details

    • backingList

      List<Object> backingList()
      Description copied from class: PairLists.AbstractPairList
      Returns a list containing the alternating left and right elements of each pair.
      Specified by:
      backingList in class PairLists.AbstractPairList<T,U>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<T>
      Specified by:
      clear in interface List<T>
      Overrides:
      clear in class AbstractList<Map.Entry<T,U>>
    • size

      public int size()
      Specified by:
      size in interface Collection<T>
      Specified by:
      size in interface List<T>
      Specified by:
      size in class AbstractCollection<Map.Entry<T,U>>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<T>
      Specified by:
      isEmpty in interface List<T>
      Overrides:
      isEmpty in class AbstractCollection<Map.Entry<T,U>>
    • get

      public Map.Entry<T,U> get(int index)
      Specified by:
      get in interface List<T>
      Specified by:
      get in class AbstractList<Map.Entry<T,U>>
    • left

      public T left(int index)
      Description copied from interface: PairList
      Returns the left part of the indexth pair.
    • right

      public U right(int index)
      Description copied from interface: PairList
      Returns the right part of the indexth pair.
    • set

      public Map.Entry<T,U> set(int index, Map.Entry<T,U> entry)
      Specified by:
      set in interface List<T>
      Specified by:
      set in interface PairList<T,U>
      Overrides:
      set in class AbstractList<Map.Entry<T,U>>
    • set

      public Map.Entry<T,U> set(int index, T t, U u)
      Description copied from interface: PairList
      Sets the entry at position index to the pair (t, u).
    • remove

      public Map.Entry<T,U> remove(int index)
      Specified by:
      remove in interface List<T>
      Specified by:
      remove in interface PairList<T,U>
      Overrides:
      remove in class AbstractList<Map.Entry<T,U>>
    • add

      public boolean add(Map.Entry<T,U> entry)
      Specified by:
      add in interface Collection<T>
      Specified by:
      add in interface List<T>
      Overrides:
      add in class AbstractList<Map.Entry<T,U>>
    • add

      public void add(int index, Map.Entry<T,U> entry)
      Specified by:
      add in interface List<T>
      Overrides:
      add in class AbstractList<Map.Entry<T,U>>
    • add

      public void add(T t, U u)
      Description copied from interface: PairList
      Adds a pair to this list.
    • add

      public void add(int index, T t, U u)
      Description copied from interface: PairList
      Adds a pair to this list at a given position.
    • addAll

      public boolean addAll(PairList<T,U> list2)
      Description copied from interface: PairList
      Adds to this list the contents of another PairList.

      Equivalent to List.addAll(Collection), but more efficient.

    • addAll

      public boolean addAll(int index, PairList<T,U> list2)
      Description copied from interface: PairList
      Adds to this list, at a given index, the contents of another PairList.

      Equivalent to List.addAll(int, Collection), but more efficient.

    • leftList

      public List<T> leftList()
      Description copied from interface: PairList
      Returns an unmodifiable list view consisting of the left entry of each pair.
    • rightList

      public List<U> rightList()
      Description copied from interface: PairList
      Returns an unmodifiable list view consisting of the right entry of each pair.
    • forEach

      public void forEach(BiConsumer<T,U> consumer)
      Description copied from interface: PairList
      Calls a BiConsumer with each pair in this list.
    • forEachIndexed

      public void forEachIndexed(PairList.IndexedBiConsumer<T,U> consumer)
      Description copied from interface: PairList
      Calls a BiConsumer with each pair in this list.
    • toImmutableMap

      public com.google.common.collect.ImmutableMap<T,U> toImmutableMap()
      Description copied from interface: PairList
      Creates an ImmutableMap whose entries are the pairs in this list. Throws if keys are not unique.
    • immutable

      public ImmutablePairList<T,U> immutable()
      Description copied from interface: PairList
      Returns an ImmutablePairList whose contents are the same as this PairList.
    • transform

      public <R> List<R> transform(BiFunction<T,U,R> function)
      Description copied from interface: PairList
      Applies a mapping function to each element of this list.
    • transform2

      public <R> com.google.common.collect.ImmutableList<R> transform2(BiFunction<T,U,R> function)
      Description copied from interface: PairList
      Applies a mapping function to each element of this list.
    • anyMatch

      public boolean anyMatch(BiPredicate<T,U> predicate)
      Description copied from interface: PairList
      Returns whether the predicate is true for at least one pair in this list.
    • allMatch

      public boolean allMatch(BiPredicate<T,U> predicate)
      Description copied from interface: PairList
      Returns whether the predicate is true for all pairs in this list.
    • noMatch

      public boolean noMatch(BiPredicate<T,U> predicate)
      Description copied from interface: PairList
      Returns whether the predicate is true for no pairs in this list.