我有java代码从文本文件填充哈希映射.
HashMap<String, String[]> data = new HashMap<String, String[]>();
我用它来制作键值对.值是一个字符串数组.我必须迭代键值对的每个可能的组合(所以也必须迭代String [] - 数组).这适用于java,但现在我必须将其移植到delphi.有可能这样做吗?如何?谢谢!
在Delphi prism中,我们可以声明仅在特殊场合需要的变量.
例如:在棱镜中
If acondition then
begin
var a :Integer;
end;
a := 3; //this line will produce error. because a will be created only when the condition is true
Run Code Online (Sandbox Code Playgroud)
这里'a'不能与3分配,因为它嵌套在分支内.我们如何声明一个只能在delphi win32中的分支内部使用的变量.所以我可以减少内存使用量,因为它只在某个条件成立时才会被创建;
如果减少内存使用不是问题我们有什么缺点(或者我们没有)