how to create an array list with some elements in the 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"));