insert elements in list java while initializing code example
Example 1: arraylist with values java
ArrayList<String> cities = new ArrayList<>(Arrays.asList("London", "Tokyo", "New York"));
Example 2: initialize arraylist
ArrayList<Type> list = new ArrayList<Type>(Arrays.asList(
elem1, elem2,..., elemN
));