THRIFT-5788 Refactor and streamline hash set implementation
Client: delphi
Patch: Jens Geyer
Follow-up: fix memory leak
diff --git a/lib/delphi/src/Thrift.Collections.pas b/lib/delphi/src/Thrift.Collections.pas
index c0fe323..0500d49 100644
--- a/lib/delphi/src/Thrift.Collections.pas
+++ b/lib/delphi/src/Thrift.Collections.pas
@@ -224,6 +224,7 @@
public
constructor Create( const aCapacity: Integer = 0); overload;
constructor Create( const aCapacity: Integer; const aComparer : IEqualityComparer<T>); overload;
+ destructor Destroy; override;
function ToString : string; override;
end;
@@ -263,6 +264,14 @@
FDictionary := TDictionary<T,Byte>.Create( aCapacity, aComparer);
end;
+
+destructor TThriftHashSetImpl<T>.Destroy;
+begin
+ FDictionary.Free;
+ inherited Destroy;
+end;
+
+
function TThriftHashSetImpl<T>.GetCount: Integer;
begin
Result := FDictionary.Count;