uses
  dya_hashmap_objects;

const
  KEYS: array[0 .. 31] of AnsiString = (
    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
    'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
    'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
    'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G'
  );

type
PObj = ^TObj;
TObj = object
public
  procedure Done;
end;

THashMapOfObj = specialize THashMapOfObject<TObj>;

procedure TObj.Done;
begin
end;

var
  H: THashMapOfObj;
  O: TObj;
  P: PObj;
  I: LongInt;

procedure WritelnStats(constref HashMap: THashMapOfObj);
var
  Stats: THashMapOfObj.TStats;
begin
  HashMap.GetStats(Stats);
  Writeln('Buckets:    ', Stats.Buckets);
  Writeln('Pairs:      ', Stats.Pairs);
  Writeln('Collisions: ', Stats.Collisions);
  Writeln('Allocated:  ', Stats.Allocated, ' bytes');
  Writeln('Noncontiguous memory regions: ', Stats.Noncontiguous);
end;

procedure WritelnHas(const Key: AnsiString);
begin
  Writeln('Has ', Key, ': ', H.Has(Key));
end;

begin
  H.Init;
  WritelnStats(H);
  for I := 0 to High(KEYS) do
    H.Add(KEYS[I], O);
  WritelnHas('a');
  WritelnHas('b');
  WritelnHas('z');
  WritelnHas('A');
  WritelnHas('Z');
  if H.Find('a', P) then begin
  end;
  if H.Find('d', P) then begin
  end;
  WritelnStats(H);
  H.Done;
end.
