Code: Select all
List<String> list = new ArrayList<>(10);
Additionally: there are some new line chars missing in the main explanation, so sample code lines look like they have invalid comments, for example:[...] So list.getSize() would still return 0.
Map<String, List<String>> myMap = new HashMap<String, List<String>>();In Java SE 7, you can substitute the parameterized type of the constructor with an empty set of type parameters (<>):