The traditional way to create list is
List<String> colors = new ArrayList<String>();
colors.add("Red");
colors.add("Green");
colors.add("Blue");
If you want a list with only one element, then this is probably best way to create a list. List created by this way is immutable. That means we can not add more elements to this colors list
List<String> colors = Collections.singletonList("Red");
List<String> colors = Arrays.asList("Red", "Green", "Blue");
This can create and initialize the List in one line but has got some limitations again. This list colors is immutable. if you will add/delete any additional element to this list, this will throw java.lang.UnsupportedOperationException
exception.
List<String> colors = new ArrayList<String>(Arrays.asList("Red", "Green", "Blue"));
This will create a mutable list which means further modification (addition, removal) to the is allowed.
List<String> colors = new ArrayList<String>();
Collections.addAll(colors,"Red","Green","Blue");
List<String> colors = new ArrayList<String>() {{
add("Red");
add("Green");
add("Blue");
}};