Remove(Key: String);
Key - key of the element that should be removed.
The Remove method removes the element, which key is passed by the Key parameter.
Sub Main;
Var
StrMap: IStringMap;
i: Integer;
Begin
StrMap:=New StringMap.Create;
For i:=0 To Math.RandBetweenI(50,100) Do
StrMap.Add("Key_"+Math.RandBetweenI(0,100).ToString ,"Value "+Math.RandBetweenI(0,100).ToString);
End For;
StrMap.Remove(StrMap.Key(StrMap.Count-1));
End Sub Main;
After executing the example a map of strings of random size is generated, elements with repeated keys are overwritten. The last element of the map is removed.
See also: