0
訪問在地圖<類,字符串>變量I具有與類LinkedHashMap中作爲關鍵這樣:由Index
private final Map<Files, String> list = new LinkedHashMap<Files,String>();
文件是由3個變量的一類:
class Files {
public String file;
public String duration;
public String status;
}
現在我需要使用索引訪問文件中的變量。我知道,LinkedHashMap中不允許使用檢索索引值,所以我想這:
List<Entry<Files,String>> randAccess = new ArrayList<Entry<Files,String>>(list.entrySet());
使用randAccess.get(index)
我可以檢索密鑰本身,而不是特定變量的類中。所以輸出結果就像Files @ 6aa91761 = String。
我希望能夠得到這個變量,例如:list.Files.status.Get(index)
將返回在正確的索引「status」的值。
謝謝感謝幫助! – Omid 2013-04-06 19:06:01