Class Pair.MutableZipList<K,​V>

  • Type Parameters:
    K - Key (left) value type
    V - Value (right) value type
    All Implemented Interfaces:
    java.lang.Iterable<Pair<K,​V>>, java.util.Collection<Pair<K,​V>>, java.util.List<Pair<K,​V>>
    Enclosing class:
    Pair<T1,​T2>

    private static class Pair.MutableZipList<K,​V>
    extends java.util.AbstractList<Pair<K,​V>>
    A mutable list of pairs backed by a pair of mutable lists.

    Modifications to this list are reflected in the backing lists, and vice versa.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<K> ks  
      private java.util.List<V> vs  
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      MutableZipList​(java.util.List<K> ks, java.util.List<V> vs)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, Pair<K,​V> pair)  
      Pair<K,​V> get​(int index)  
      Pair<K,​V> remove​(int index)  
      Pair<K,​V> set​(int index, Pair<K,​V> pair)  
      int size()  
      • Methods inherited from class java.util.AbstractList

        add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
      • Methods inherited from class java.util.AbstractCollection

        addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
    • Field Detail

      • ks

        private final java.util.List<K> ks
      • vs

        private final java.util.List<V> vs
    • Constructor Detail

      • MutableZipList

        MutableZipList​(java.util.List<K> ks,
                       java.util.List<V> vs)
    • Method Detail

      • get

        public Pair<K,​V> get​(int index)
        Specified by:
        get in interface java.util.List<K>
        Specified by:
        get in class java.util.AbstractList<Pair<K,​V>>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<K>
        Specified by:
        size in interface java.util.List<K>
        Specified by:
        size in class java.util.AbstractCollection<Pair<K,​V>>
      • add

        public void add​(int index,
                        Pair<K,​V> pair)
        Specified by:
        add in interface java.util.List<K>
        Overrides:
        add in class java.util.AbstractList<Pair<K,​V>>
      • remove

        public Pair<K,​V> remove​(int index)
        Specified by:
        remove in interface java.util.List<K>
        Overrides:
        remove in class java.util.AbstractList<Pair<K,​V>>
      • set

        public Pair<K,​V> set​(int index,
                                   Pair<K,​V> pair)
        Specified by:
        set in interface java.util.List<K>
        Overrides:
        set in class java.util.AbstractList<Pair<K,​V>>