📅  最后修改于: 2022-03-11 14:52:11.587000             🧑  作者: Mango
// generic methods
public List fromArrayToList(T[] a) {
return Arrays.stream(a).collect(Collectors.toList());
}
public static List fromArrayToList(T[] a, Function mapperFunction) {
return Arrays.stream(a)
.map(mapperFunction)
.collect(Collectors.toList());
}
// bounded generics
public List fromArrayToList(T[] a) {
...
}
//multiple bounds
// upper bound wildcards
public static void paintAllBuildings(List extends Building> buildings) {
...
}
// lower bound wildcard
super T>