Class IndexedList<K,V>

java.lang.Object
org.yamcs.utils.IndexedList<K,V>
All Implemented Interfaces:
Iterable<V>

public class IndexedList<K,V> extends Object implements Iterable<V>
List which is indexed by a key in addition to its natural integer index

Does not allow removal

  • Field Details

  • Constructor Details

    • IndexedList

      public IndexedList()
    • IndexedList

      public IndexedList(IndexedList<K,V> list)
    • IndexedList

      public IndexedList(int size)
  • Method Details

    • add

      public void add(K key, V value)
    • getIndex

      public int getIndex(K key)
      returns the index of the element with key or -1 if there is no such element
      Parameters:
      key -
      Returns:
      returns the index of the element with key or -1 if there is no such element
    • hasKey

      public boolean hasKey(K key)
      Parameters:
      key -
      Returns:
      true if the list contains the key
    • get

      public V get(K key)
      Returns the value mapped to the key or null if there is no such element
      Parameters:
      key -
      Returns:
    • get

      public V get(int idx)
      Parameters:
      idx -
      Returns:
      See Also:
    • iterator

      public Iterator<V> iterator()
      Specified by:
      iterator in interface Iterable<K>
    • size

      public int size()
      Returns:
      returns the size of the list.
    • changeKey

      public void changeKey(K oldKey, K newKey)
    • getList

      public List<V> getList()
    • set

      public void set(int idx, V value)
    • toString

      public String toString()
      Overrides:
      toString in class Object