ArrayList returned by Arrays.asList , not java.util.ArrayList . This is java.util.Arrays.ArrayList . Therefore, you cannot direct it to java.util.ArrayList .
You need to pass the list to the constructor of the java.util.ArrayList class:
List<String> items = new ArrayList<String>(Arrays.asList(CommaSeparated.split("\\s*,\\s*")));
or you can just assign the result:
List<String> items = Arrays.asList(CommaSeparated.split("\\s*,\\s*"));
but notice, Arrays.asList returns a list of fixed sizes. You cannot add or remove anything in it. If you want to add or remove something, you must use the 1st version.
PS: You should use List as a reference type instead of ArrayList .
source share