delphi hashmap? [英] delphi hashmap?

查看:211
本文介绍了delphi hashmap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java代码从一个文本文件中填充一个hashmap。

HashMap< String,String []> data = new HashMap< String,String []>();



我使用它来创建键值对。这些值是一个字符串数组。我必须迭代键值对的每个可能的组合(所以也必须遍历String [] - 数组)。这可以与java一起工作,但现在我必须将其移植到delphi。有可能吗?如何?
谢谢!

解决方案

在Delphi 2009及更高版本中,您可以使用 TDictionary< string,TStringlist> 使用Genericics.Collections。



在旧版本中,您可以使用TStringlist,其中TStringlist中的每个项目都具有TStrings类型的关联对象值。



Docwiki有一个页面来开始与TDictionary


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!

解决方案

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

这篇关于delphi hashmap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆