When I try to remove the element from the list using removeIf()
, It is throwing UnsupportedOperationException
public class T {
public static void main(String[] args) {
String[] arr = new String[] { "1", "2", "3" };
List<String> stringList = Arrays.asList(arr);
stringList.removeIf((String string) -> string.equals("2"));
}
}
Can some one help me understand why this is happening and how can I rectify this ?