Example: Declaring Generics with and Without Diamond
// Without diamond operator
List<String> list = new ArrayList<String>();
Map<Reference<Object>, Map<Integer, List<String>>> map =
new HashMap<Reference<Object>, Map<Integer, List<String>>>();
// With diamond operator
List<String> list = new ArrayList<>();
Map<Reference<Object>, Map<Integer, List<String>>> map = new HashMap<>();
Nessun commento:
Posta un commento