Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delphi hashmap?

Tags:

hashmap

delphi

i have java-code filling a hashmap from a textfile.
HashMap<String, String[]> data = new HashMap<String, String[]>();

i use this to make key-value-pairs. the values are an array of string. i have to iterate over every possible combo of the key-value-pairs (so also have to iterate over the String[]-array). This works with java but now i have to port this to delphi. is it possible to do so? and how? thanks!

like image 373
someuser Avatar asked Apr 04 '11 08:04

someuser


People also ask

What is the HashMap?

Basically, a HashMap allows you to store items with identifiers. They are stored in a table format with the identifier being hashed using a hashing algorithm. Typically they are more efficient to retrieve items than search trees etc.

What is the use of HashMap?

HashMap is a data structure that uses a hash function to map identifying values, known as keys, to their associated values. It contains “key-value” pairs and allows retrieving value by key.

What is map in HashMap?

HashMap is a non-synchronized class of the Java Collection Framework that contains null values and keys, whereas Map is a Java interface, which is used to map key-pair values.

What is the use of HashMap in Android Studio?

Hash table based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. (The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.)


1 Answers

In Delphi 2009 and higher, you can use TDictionary<string, TStringlist> using Generics.Collections.

In older versions, you can use TStringlist where every item in the TStringlist has an associated object value of type TStrings.

The Docwiki has a page to get started with TDictionary

like image 197
mjn Avatar answered Sep 18 '22 12:09

mjn