Class MapMessage<K,V>

Type Parameters:
K - Type of the keys in the map
V - Type of the values in the map
All Implemented Interfaces:
Serializable, Cloneable

public class MapMessage<K,V> extends ObjectMessage<Map<K,V>>
This class could be used to build message conveying Map objects between MaDKit agents.
Since:
MaDKit 5.1.2
See Also:
  • Constructor Details

    • MapMessage

      public MapMessage(Map<K,V> map)
      Builds a MapMessage containing the specified map
      Parameters:
      map - the original map
    • MapMessage

      public MapMessage()
      /** Builds a MapMessage containing an empty HashMap}
  • Method Details

    • put

      public V put(K key, V value)
      invoke Map.put(Object, Object) on the map contained in this message.
      Parameters:
      key - key with which the specified value is to be associated
      value - value to be associated with the specified key
      Returns:
      the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)
      Throws:
      UnsupportedOperationException - if the put operation is not supported by this map
      ClassCastException - if the class of the specified key or value prevents it from being stored in this map
      NullPointerException - if the specified key or value is null and this map does not permit null keys or values
      IllegalArgumentException - if some property of the specified key or value prevents it from being stored in this map
    • get

      public V get(K key)
      invoke Map.get(Object) on the map contained in this message
      Parameters:
      key - the key whose associated value is to be returned
      Returns:
      the value to which the specified key is mapped, or null if this map contains no mapping for the key