Class Map1L<K,V>

java.lang.Object
components.map.MapSecondary<K,V>
components.map.Map1L<K,V>
Type Parameters:
K - type of Map domain (key) entries
V - type of Map range (associated value) entries
All Implemented Interfaces:
Map<K,V>, MapKernel<K,V>, Standard<Map<K,V>>, Iterable<Map.Pair<K,V>>

public class Map1L<K,V> extends MapSecondary<K,V>
Map represented as a java.util.Map with implementations of primary methods.
Abstraction Relation (interpretation mapping between $this and this):
this = [value of $this]
  • Constructor Details

    • Map1L

      public Map1L()
      No-argument constructor.
  • Method Details

    • newInstance

      public final Map<K,V> newInstance()
      Description copied from interface: Standard
      Returns a new object with the same dynamic type as this, having an initial value. If the type T has a no-argument constructor, then the value of the new returned object satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then the value of the new returned object satisfies the contract of the constructor call that was used to initialize this .
      Returns:
      new object "like" this with an initial value
    • clear

      public final void clear()
      Description copied from interface: Standard
      Resets this to an initial value. If the type T has a no-argument constructor, then this satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then this satisfies the contract of the constructor call that was used to initialize #this.
    • transferFrom

      public final void transferFrom(Map<K,V> source)
      Description copied from interface: Standard
      Sets this to the incoming value of source, and resets source to an initial value; the declaration notwithstanding, the dynamic type of source must be the same as the dynamic type of this. If the type T has a no-argument constructor, then source satisfies the contract of the no-argument constructor for T. If T does not have a no-argument constructor, then source satisfies the contract of the constructor call that was used to initialize #source.
      Parameters:
      source - object whose value is to be transferred
    • add

      public final void add(K key, V value)
      Description copied from interface: MapKernel
      Adds the pair (key, value) to this.
      Parameters:
      key - the key to be added
      value - the associated value to be added
    • remove

      public final Map.Pair<K,V> remove(K key)
      Description copied from interface: MapKernel
      Removes the pair whose first component is key and returns it.
      Parameters:
      key - the key to be removed
      Returns:
      the pair removed
    • removeAny

      public final Map.Pair<K,V> removeAny()
      Description copied from interface: MapKernel
      Removes and returns an arbitrary pair from this.
      Returns:
      the pair removed from this
    • value

      public final V value(K key)
      Description copied from interface: MapKernel
      Reports the value associated with key in this.
      Parameters:
      key - the key whose associated value is to be reported
      Returns:
      the value associated with key
    • hasKey

      public final boolean hasKey(K key)
      Description copied from interface: MapKernel
      Reports whether there is a pair in this whose first component is key.
      Parameters:
      key - the key to be checked
      Returns:
      true iff there is a pair in this whose first component is key
    • size

      public final int size()
      Description copied from interface: MapKernel
      Reports size of this.
      Returns:
      the number of pairs in this
    • iterator

      public final Iterator<Map.Pair<K,V>> iterator()
    • replaceValue

      public final V replaceValue(K key, V value)
      Description copied from interface: Map
      Replaces the value associated with key in this with value and returns the old value.
      Specified by:
      replaceValue in interface Map<K,V>
      Overrides:
      replaceValue in class MapSecondary<K,V>
      Parameters:
      key - the key whose associated value is replaced
      value - the value replacing the old one
      Returns:
      the old value associated with the given key