java make a list then append items to it code example
Example 1: java append to list
package com.journaldev.examples;
import java.util.ArrayList;
import java.util.List;
public class ListAddExamples {
public static void main(String[] args) {
List<String> vowels = new ArrayList<>();
vowels.add("A");
vowels.add("E");
vowels.add("U");
System.out.println(vowels);
vowels.add(2, "I");
vowels.add(3, "O");
System.out.println(vowels);
}
}
Example 2: java add a list to a list
List mylist.addAll(secondList);