java - Initialization of an ArrayList in one line - Stack Overflow
https://stackoverflow.com/questions/1005073/initialization-of-an-arraylist-in-one-line
WEBJun 17, 2009 · 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: Space Efficiency.
DA: 3 PA: 18 MOZ Rank: 31