set value to arraylist during object creation 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"));