Are there any hash arrays in Delphi?

I studied Delphi, but loved to use hash arrays in Perl and Java. Do Delphi have data structures for comparisons?

I know that TStringList can be used as an array of hashes:

var myHash:TStringList); begin myHash:=TStringList.Create(); myHash.values['color']:='blue'; Showmessage(myHash.Values['color']); //blue myHash.free; end; 

Is it possible to build more complex data structures in Delphi, such as a Perl hash of arrays, etc.

+6
source share
1 answer

If you are using Delphi 2009 or later (and hopefully later because there was a serious error in the original implementation), you can find the TDictionary class in the Generics.Collections module. TDictionar<TKey, TValue> functions as a hash map of keys to values ​​that should be exactly what you are looking for.

+8
source

Source: https://habr.com/ru/post/974045/


All Articles