Compartir a través de


Map.remove(Object) Method

Definition

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

public:
 bool remove(System::Object ^ _keyValue);
public bool remove (object _keyValue);
member this.remove : obj -> bool
Public Function remove (_keyValue As Object) As Boolean

Parameters

_keyValue
Object

The value of the key to delete.

Returns

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

Remarks

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; 
}

Applies to