private static Map<String, ArrayList<String>> loadValues = new HashMap<String,ArrayList<String>>();
static ArrayList details = new ArrayList<String>();
我輸入2組值... say .. key:1值:abc,[email protected],555和key:2值:xyz,x @ z .com,765ArrrayList在檢索鍵值的Hashmap中
我試過了。
System.out.println("Enter the User ID:");
userID = in.next();
System.out.println("Enter your name:");
name = in.next();
details.add(name);
System.out.println("Enter your e-mail:");
email = in.next();
details.add(email);
System.out.println("Enter your contact number:");
contactNo = in.next();
details.add(contactNo);
loadValues.put(userID, details);
和使用迭代器打印... 當我嘗試打印,其打印像...
1: abc, [email protected], 555 ,xyz,[email protected],765
2: abc, [email protected], 555 ,xyz,[email protected],765
但是,我需要打印,1: abc, [email protected], 555 and 2: xyz,[email protected],765
我應該怎麼辦?
您能否提供您用於打印值的代碼? – Smallhacker 2013-05-10 11:01:21