private static Map<String, ArrayList<String>> loadValues = new HashMap<String,ArrayList<String>>();
static ArrayList details = new ArrayList<String>();
我输入 2 组值...比如说.. key:1 值:abc, c@c.com, 555 和 key:2 值:xyz,x@z.com,765
我试过这个。
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, c@c.com, 555 ,xyz,x@z.com,765
2: abc, c@c.com, 555 ,xyz,x@z.com,765
但是,我需要打印, 1: abc, c@c.com, 555 and 2: xyz,x@z.com,765
我该怎么办?