you are on the right track, the set_val needs to override the initial (key, value) (if present) and start afresh (as seen from python code):

def set_val(key:string,value:string)={
  if (internalstorage.contains(key)) 
    internalstorage.remove(key); // to start fresh

also, as the internalstorage is being accessed only using storage, you might want to make it private.

private[this] val internalstorage=new hashmap[string, set[string]] with multimap[string, string]

Related Query

More Query from same tag