Class MapMessage<K,V>
- Type Parameters:
K- Type of the keys in the mapV- Type of the values in the map
- All Implemented Interfaces:
Serializable,Cloneable
This class could be used to build message conveying
Map objects between MaDKit
agents.- Since:
- MaDKit 5.1.2
- See Also:
-
Constructor Summary
ConstructorsConstructorDescription/** Builds aMapMessagecontaining an emptyHashMap}MapMessage(Map<K, V> map) Builds aMapMessagecontaining the specified map -
Method Summary
Modifier and TypeMethodDescriptioninvokeMap.get(Object)on the map contained in this messageinvokeMap.put(Object, Object)on the map contained in this message.Methods inherited from class madkit.messages.ObjectMessage
getContent, toStringMethods inherited from class madkit.kernel.Message
clone, getConversationID, getReceiver, getSender, getSenderRole
-
Constructor Details
-
MapMessage
-
MapMessage
public MapMessage()/** Builds aMapMessagecontaining an emptyHashMap}
-
-
Method Details
-
put
invokeMap.put(Object, Object)on the map contained in this message.- Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Returns:
- the previous value associated with
key, ornullif there was no mapping forkey. (Anullreturn can also indicate that the map previously associatednullwithkey, if the implementation supportsnullvalues.) - Throws:
UnsupportedOperationException- if theputoperation is not supported by this mapClassCastException- if the class of the specified key or value prevents it from being stored in this mapNullPointerException- if the specified key or value is null and this map does not permit null keys or valuesIllegalArgumentException- if some property of the specified key or value prevents it from being stored in this map
-
get
invokeMap.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
nullif this map contains no mapping for the key
-