java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Test02 {
public static void main(String[] args) {
//分析方法:由外层向内层逐渐拆解要定义的变量。再由内向外进行变量赋值
//外层第一层:mapParen
//表示其类型为 Map 类型。而 mapParen 中的每个元素键的类型为 String ,值的类型为 Map
Map<String,Map<String, List<Map<String,Integer>>>> mapParen = new HashMap<>();
//外层第二层即分析 mapParen 变量中元素值的类型。先定义变量 son2
//其类型为 Map 类型。其中每个元素键的类型为 String ,值的类型为 List 类型
Map<String,List<Map<String,Integer>>> son2 = new HashMap<>();
//外层第三层即分析 son2 变量中元素值的类型。先定义变量 son3
//其类型为 List 类型。其中每个元素的类型为 Map 类型
List<Map<String,Integer>> son3 = new ArrayList<>();
//外层第四层
Map<String,Integer> son4 = new HashMap<>();
//赋值
son4.put("小明",25);
son3.add(son4);
son2.put("大明",son3);
mapParen.put("大大明",son2);
System.out.println(mapParen);
}
}
