List数组:存储List的数组,即:数组中的元素是:List;
数组List:存储数组的List,即:List中的数据是类型的数组;

测试案例:

import java.util.ArrayList;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;/* *List数组,数组List * */public class day15 {public static void main(String[] args) {List<Map<String,Object>> list = new ArrayList<>();Map<String,Object> map1 = new HashMap<>();map1.put("region","西安");map1.put("num",1.0);map1.put("count",1);list.add(map1);List<Map<String,Object>> list2 = new ArrayList<>();Map<String,Object> map2 = new HashMap<>();map2.put("region","武汉");map2.put("num",1.0);map2.put("count",2);list2.add(map2);List<Map<String,Object>> list3 = new ArrayList<>();Map<String,Object> map3 = new HashMap<>();map3.put("region","苏州");map3.put("num",1.0);map3.put("count",3);list3.add(map3);// List数组:存储List的数组,即数组中的元素是:List// 用法1:List[] obj = {list,list2,list3};for (int i = 0; i < obj.length; i++) {System.out.println("List数组:"+obj[i]);}System.out.println("--------------------------");// 用法2:List[] s = new List[3];// 先声明长度:必须大于零;长度可通过计算得出;s[0] = list;s[1] = list2;s[2] = list3;for (int i = 0; i < s.length; i++) {System.out.println("List数组:"+s[i]);}System.out.println("--------------------------");// 数组List:存储数组的List,即:List中的数据是类型的数组;List<int[]> list4 = new ArrayList<>();int[] arr1 = {1,2,3};int[] arr2 = {4,5,6};list4.add(arr1);list4.add(arr2);for (int i = 0; i < list4.size(); i++) {int[] arr = list4.get(i);for (int j = 0; j < arr.length; j++) {System.out.println("数组List:"+arr[j]);}}}}

测试输出:

List<T>数组:[{num=1.0, count=1, region=西安}]List<T>数组:[{num=1.0, count=2, region=武汉}]List<T>数组:[{num=1.0, count=3, region=苏州}]--------------------------List<T>数组:[{num=1.0, count=1, region=西安}]List<T>数组:[{num=1.0, count=2, region=武汉}]List<T>数组:[{num=1.0, count=3, region=苏州}]--------------------------数组List<T>:1数组List<T>:2数组List<T>:3数组List<T>:4数组List<T>:5数组List<T>:6