I have two strings having comma separated values, say one having numbers from 1 to 10 and another having prime numbers. I want to
remove prime numbers from numbers
.
Here's my code snippet:
String numbers = "1,2,3,4,5,6,7,8,9,10";
String prime = "2,3,5,7";
List<String> numList = Arrays.asList(numbers.split(","));
numList.removeAll(Arrays.asList(prime.split(",")));
I'm getting UnsupportedOperationException. Any help would be appreciated.