我有數組列表中的散列。如何將哈希表的Arraylist轉換爲其他意圖?
List<Hashtable<String, String>> info = new ArrayList<Hashtable<String, String>>();
Hashtable<String, String> hm = new Hashtable<String, String>();
// Put elements to the map
hm.put("Read_Flag", s1);
hm.put("sms_received_id", s2);
hm.put("Sender_Id", s3);
hm.put("Sender_Name", s4);
hm.put("Patient_Name", s5);
hm.put("Received_Date", s6);
hm.put("Received_Text", s7);
hm.put("Received_Text_Full", s8);
hm.put("AttachmentFlag", s9);
// Get a set of the entries
Set<?> set = hm.entrySet();
// Get an iterator
Iterator<?> it = set.iterator();
// Display elements
while(it.hasNext()) {
Map.Entry me = (Map.Entry)it.next();
// System.out.print(me.getKey() + ": ");
// System.out.println(me.getValue());
}
//System.out.println(hm);
info.add(hm);
此處的信息包含我的哈希表。我怎樣才能得到這個「信息」對象到其他類/意圖?
謝謝你......
這可能只是我,但我不明白你問什麼。也許一個例子或更多的解釋會有所幫助。 – Thomas 2012-01-04 11:04:36
不確定你的意思?你能否簡化一下? – 2012-01-04 11:04:55
我怎樣才能得到這個「信息」對象在其他類? – Anand 2012-01-04 11:06:13