I tried doing something like what these people have done: How to split a comma-separated string? But when I do the following:
String UserInput = new Scanner(System.in).next();
GradesNonInt = Arrays.asList(UserInput.replaceAll("\\s","").split(","));
System.out.println(GradesNonInt.size());
When I input a string like "1,2,3" I get 3 printed. When I type "1, 2, 3" I get 1 printed. For some reason, it does not want to work when the string has spaces in it.
As one of the answers below said, entering "1, 2, 3" directly seems to work fine, but yet when taken from the Scanner(System.in).next(), it is not.