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 aMapMessage
containing an emptyHashMap
}MapMessage
(Map<K, V> map) Builds aMapMessage
containing 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, toString
Methods inherited from class madkit.kernel.Message
clone, getConversationID, getReceiver, getSender, getSenderRole
-
Constructor Details
-
MapMessage
-
MapMessage
public MapMessage()/** Builds aMapMessage
containing 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
, ornull
if there was no mapping forkey
. (Anull
return can also indicate that the map previously associatednull
withkey
, if the implementation supportsnull
values.) - Throws:
UnsupportedOperationException
- if theput
operation 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
null
if this map contains no mapping for the key
-