java add elements to arraylist at declaring code example
Example 1: arraylist with values java
ArrayList<String> cities = new ArrayList<>(Arrays.asList("London", "Tokyo", "New York"));
Example 2: java arraylist declaration
ArrayList<E> yourArray = new ArrayList<E>();
//'E' can be raplaced with any data type or object, or left as
// E if used for general funcitonality