I am trying to create a method that accepts the type of collection and the type of items inside the collection.
ArrayList<Integer> ints = getCollection(ArrayList.class, Integer.class);
How do I write the getCollection so that, given any Collection subclass and any Number subclass, the method should create a collection and populate it with random elements of Number or subtype of Number?
Aucun commentaire:
Enregistrer un commentaire