public class Main {
public static void main(String[] args) {
List<Integer> listInt = getList(1, 2);
List<String> listString = getList("2, 3");
System.out.println(listInt); // [1, 2]
System.out.println(listString); // [2, 3]
}
public static <T> List<T> getList(T... arg) {
return List.of(arg);
}
}