代码:
import java.util.*;
import java.lang.*;
//import java.util.Map;
public class HelloWorld{
public static void main(String []args){
//System.out.println("Hello World");
//List<String> list = new ArrayList();
//list.add("1","Jeni","234","24wd3d");
//list.add("wer");
//System.out.println(list);
/*String[][] details = { {"1", "Jeni", "23", "we"},
{"2", "Honey", "34", "er"},
{"3", "sam", "45", "rt"} };
//Map personalDetails = ArrayUtils.toMap(details);
//System.out.println(personalDetails);*/
int[] keys = new int[] {1, 2, 3};
String[][] details = { {"Jeni", "23", "we"},
{"Honey", "34", "er"},
{"sam", "45", "rt"} };
HashMap<Integer,String[]> map = new HashMap<>();
for (int i = 0; i < details.length; i++){
map.put(keys[i], details[i]);
System.out.println(details[i][0]);
}
//int index = map.size();
//for( int i=0; i<index; i++){
System.out.println(map.values());
}
}
输出:
珍妮 蜜糖 山姆
[[Ljava.lang.String; @ 6d06d69c,[Ljava.lang.String; @ 7852e922,[Ljava.lang.String; @ 4e25154f]