import ceylon.collection {

import java.util {

"A Ceylon [[MutableMap]] that wraps a [[java.util::Map]].

 If the given [[map]] contains null elements, an optional
 [[Item]] type must be explicitly specified, for example:


 If a non-optional `Item` type is specified, an
 [[AssertionError]] will occur whenever a null item is
 encountered while iterating the map."
shared class CeylonMutableMap<Key, Item>(map)
        extends CeylonMap<Key, Item>(map)
        satisfies MutableMap<Key, Item> 
        given Key satisfies Object 
        given Item satisfies Object {

    JMap<Key, Item> map;
    put(Key key, Item item) => map.put(key, item);
    remove(Key key) => map.remove(key);
    /*removeEntry(Key key, Item item) => map.remove(key, item);
    replaceEntry(Key key, Item item, Item newItem) 
            => map.replace(key, item, newItem);*/
    clear() => map.clear();
    clone() => CeylonMutableMap(HashMap(map));