Clone: IStringMap;
The Clone method creates a copy of map of character strings.
Sub Main;
Var
StrMap, StrMap1: IStringMap;
i: Integer;
Begin
StrMap:=New StringMap.Create;
StrMap1:=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;
StrMap1:=StrMap.Clone;
StrMap.Clear;
End Sub Main;
After executing the example a map of strings of random size is generated, elements with repeated keys are overwritten. The StrMap1 variable contains a copy of the StrMap map.
See also: