Map.remove Method

Removes a (key, value) pair from a map.

Syntax

public boolean remove(anytype keyValue)

Run On

Called

Parameters

  • keyValue
    Type: anytype
    The value of the key to delete.

Return Value

Type: boolean
true if the key was found in the map and the element has been deleted; otherwise, false.

Examples

The following example checks whether a particular key value exists in a map. If the value exists, the method deletes the key and its corresponding value. The method returns true if the value was found and false if the key did not exist in the map.

public boolean clear(str owner) 
{ 
    // maps is a class variable 
    if (maps.exists(owner)) 
    { 
        maps.remove(owner); 
    } 
    else 
    { 
        return false; 
    } 
  
    return true; 
}

See Also

Map Class

Map.insert Method

Map.exists Method