I'm not entirely comfortable with generics and thus haven't found a solution to this yet. I have these three methods:
public static List<ObjectA> objectAAsList(ObjectA ... items) {
return new ArrayList<>(Arrays.asList(items));
}
public static List<ObjectB> objectBAsList(ObjectB ... items) {
return new ArrayList<>(Arrays.asList(items));
}
public static List<ObjectC> objectCAsList(ObjectC ... items) {
return new ArrayList<>(Arrays.asList(items));
}
How can I create a single method that takes a vararg of T (or something) and creates an ArrayList of it?