Browse Source

Add Clear method for THashSet

maciej-izak 7 years ago
parent
commit
660888527c
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Units/Utils/generics.collections.pas

+ 6 - 0
Units/Utils/generics.collections.pas

@@ -427,6 +427,7 @@ type
     destructor Destroy; override;
     function Add(constref AValue: T): Boolean;
     function Remove(constref AValue: T): Boolean;
+    procedure Clear;
     function Contains(constref AValue: T): Boolean; inline;
     procedure UnionWith(AHashSet: THashSet<T>);
     procedure IntersectWith(AHashSet: THashSet<T>);
@@ -1617,6 +1618,11 @@ begin
     FInternalDictionary.DoRemove(LIndex, cnRemoved);
 end;
 
+procedure THashSet<T>.Clear;
+begin
+  FInternalDictionary.Clear;
+end;
+
 function THashSet<T>.Contains(constref AValue: T): Boolean;
 begin
   Result := FInternalDictionary.ContainsKey(AValue);