how to initialize an arraylist with values in java code example
Example 1: arraylist with values java
ArrayList<String> cities = new ArrayList<>(Arrays.asList("London", "Tokyo", "New York"));
Example 2: arraylist with values
List<String> x = new ArrayList<>(Arrays.asList("xyz", "abc"));