As of Java 8 and Stream API you can use Arrays.stream
and Collectors.toList
:
String[] array = new String[]{"a", "b", "c"};
List<String> list = Arrays.stream(array).collect(Collectors.toList());
This is practical especially if you intend to perform further operations on the list.
String[] array = new String[]{"a", "bb", "ccc"};
List<String> list = Arrays.stream(array)
.filter(str -> str.length() > 1)
.map(str -> str + "!")
.collect(Collectors.toList());