In Java 9 we can easily initialize an ArrayList
in a single line:
List<String> places = List.of("Buenos Aires", "Córdoba", "La Plata");
or
List<String> places = new ArrayList<>(List.of("Buenos Aires", "Córdoba", "La Plata"));
This new approach of Java 9 has many advantages over the previous ones:
See this post for more details ->What is the difference between List.of and Arrays.asList?