我有这个领域:
HashMap<String, HashMap> selects = new HashMap<String, HashMap>();
对于每个Hash<String, HashMap>我都需要创建一个ComboBox,其项是的值(恰好是HashMap本身)HashMap<String, **HashMap**>。
Hash<String, HashMap>
ComboBox
HashMap<String, **HashMap**>
通过(无功能的)演示:
for (int i=0; i < selects.size(); i++) { HashMap h = selects[i].getValue(); ComboBox cb = new ComboBox(); for (int y=0; y < h.size(); i++) { cb.items.add(h[y].getValue); } }
我知道我对那件事有些迟了,但是我也会分享我所做的,以防它对其他人有帮助:
HashMap<String, HashMap> selects = new HashMap<String, HashMap>(); for(Map.Entry<String, HashMap> entry : selects.entrySet()) { String key = entry.getKey(); HashMap value = entry.getValue(); // do what you have to do here // In your case, another loop. }