How to create an ArrayList with values in one line in Java?
Views: 212 Ask New Question
I want to create an ArrayList and assign some basic values into it. Is there any one liner solution available for this in Java?
You can use the static method
List<String> colors = Arrays.asList("Red", "Green", "Blue");
Answer This Question