Package helma.util

# Class CopyOnWriteMap

java.lang.Object
helma.util.WrappedMap
helma.util.CopyOnWriteMap

All Implemented Interfaces:
  `Map`

public class CopyOnWriteMap extends WrappedMap
A Map that wraps another map and creates a new copy of the wrapped map if we try to modify it. This class is wrapped as a native scripted object in JavaScript rather than exposing them through Java reflection. All methods in this class are synchronized in order not to miss the switch between original and copied map.

## Nested Class Summary

## Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K extends Object,V extends Object>`

## Field Summary

### Fields inherited from class helma.util.WrappedMap

`readonly, wrapped`

## Constructor Summary

Constructors
Constructor
Description
`CopyOnWriteMap(Map map)`
Constructor

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
`boolean`
`containsKey(Object key)`
`boolean`
`containsValue(Object value)`
`Set`
`entrySet()`
`boolean`
`equals(Object o)`
`Object`
`get(Object key)`
`int`
`hashCode()`
`boolean`
`isEmpty()`
`Set`
`keySet()`
`Object`
`put(Object key, Object value)`
`void`
`putAll(Map t)`
`Object`
`remove(Object key)`
`int`
`size()`
`String`
`toString()`
`Collection`
`values()`
`boolean`
`wasModified()`

### Methods inherited from class helma.util.WrappedMap

`isReadonly, setReadonly`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Map

`compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

## Constructor Details

### CopyOnWriteMap

public CopyOnWriteMap(Map map)
Constructor

## Method Details

### wasModified

public boolean wasModified()

### size

public int size()

Specified by:
  `size` in interface `Map`
Overrides:
  `size` in class `WrappedMap`

### isEmpty

public boolean isEmpty()

Specified by:
  `isEmpty` in interface `Map`
Overrides:
  `isEmpty` in class `WrappedMap`

### containsKey

public boolean containsKey(Object key)

Specified by:
  `containsKey` in interface `Map`
Overrides:
  `containsKey` in class `WrappedMap`

### containsValue

public boolean containsValue(Object value)

Specified by:
  `containsValue` in interface `Map`
Overrides:
  `containsValue` in class `WrappedMap`

### get

public Object get(Object key)

Specified by:
  `get` in interface `Map`
Overrides:
  `get` in class `WrappedMap`

### put

public Object put(Object key, Object value)

Specified by:
  `put` in interface `Map`
Overrides:
  `put` in class `WrappedMap`

### remove

public Object remove(Object key)

Specified by:
  `remove` in interface `Map`
Overrides:
  `remove` in class `WrappedMap`

### putAll

public void putAll(Map t)

Specified by:
  `putAll` in interface `Map`
Overrides:
  `putAll` in class `WrappedMap`

### clear

public void clear()

Specified by:
  `clear` in interface `Map`
Overrides:
  `clear` in class `WrappedMap`

### keySet

public Set keySet()

Specified by:
  `keySet` in interface `Map`
Overrides:
  `keySet` in class `WrappedMap`

### values

public Collection values()

Specified by:
  `values` in interface `Map`
Overrides:
  `values` in class `WrappedMap`

### entrySet

public Set entrySet()

Specified by:
  `entrySet` in interface `Map`
Overrides:
  `entrySet` in class `WrappedMap`

### equals

public boolean equals(Object o)

Specified by:
  `equals` in interface `Map`
Overrides:
  `equals` in class `WrappedMap`

### hashCode

public int hashCode()

Specified by:
  `hashCode` in interface `Map`
Overrides:
  `hashCode` in class `WrappedMap`

### toString

public String toString()

Overrides:
  `toString` in class `WrappedMap`