program Hash_from_two_arrays; {$APPTYPE CONSOLE} uses System.SysUtils, System.Generics.Collections; type THash = TDictionary; THashHelper = class helper for THash procedure AddItems(keys: TArray; values: TArray); end; { THashHelper } procedure THashHelper.AddItems(keys: TArray; values: TArray); var i: Integer; begin Assert(length(keys) = Length(values), 'Keys and values, must have the same size.'); for i := 0 to High(keys) do AddOrSetValue(keys[i], values[i]); end; var hash: TDictionary; i: integer; key: string; begin hash := TDictionary.Create(); hash.AddItems(['a', 'b', 'c'], [1, 2, 3]); for key in hash.Keys do Writeln(key, ' ', hash[key]); hash.Free; readln; end.