{$MODE OBJFPC}
{$MODESWITCH AUTODEREF}
uses
  dstrings,
  dhashmap_oldstyle,
  dhashfuncs;

var
  HashMap: THashMap;
  L: LongInt;
  F: TextFile;

procedure Fill;
var
  S: AnsiString;
begin
  Assign(F, 'names.lst');
  Reset(F);
  while not Eof(F) do begin
    Readln(F, S);
    HashMap.Add(S, @L);
  end;
  Close(F);
end;

begin
  L := 5;
  HashMap.Init(SizeOf(LongInt), @HashPjw32);
  Fill;
  Writeln('Elements count: ', HashMap.GetCount);
  Writeln('All Collisions: ', HashMap.GetAllCollisions);
  Writeln('Max Collisions: ', HashMap.GetMaxCollisions);
  HashMap.Done;
end.
