Class ValueProtectingMap<K extends Serializable,V extends Serializable>

java.lang.Object
org.alfresco.util.ValueProtectingMap<K,V>
Type Parameters:
K - the map key type (must extend Serializable)
V - the map value type (must extend Serializable)
All Implemented Interfaces:
Serializable, Map<K,V>

public class ValueProtectingMap<K extends Serializable,V extends Serializable> extends Object implements Map<K,V>, Serializable
A map that protects keys and values from accidental modification.

Use this map when keys or values need to be protected against client modification. For example, when a component pulls a map from a common resource it can wrap the map with this class to prevent any accidental modification of the shared resource.

Upon first write to this map , the underlying map will be copied (selectively cloned), the original map handle will be discarded and the copied map will be used. Note that the map copy process will also occur if any mutable value is in danger of being exposed to client modification. Therefore, methods that iterate and retrieve values will also trigger the copy if any values are mutable.

Since:
3.4.9, 4.0.1
Author:
Derek Hulley
See Also: