函数定义泛型List<Map<String, ?>> map,编译无法通过,写成List<? extends Map<String, ?>> map即可
package seaboot.test; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; public class Test2 { public static void test(List<Map<String, ?>> map) { } public static void main(String[] args) throws IOException { List<Map<String, Object>> map = new ArrayList<>(); test(map); } } package seaboot.test; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; public class Test2 { public static void test(List<? extends Map<String, ?>> map) { } public static void main(String[] args) throws IOException { List<Map<String, Object>> map = new ArrayList<>(); test(map); } }