java.lang.UnsupportedOperationException at java.util.AbstractList.remove(Unknown Source)
2022-08-31 15:56:27
I have tried below code
String s[]={"1","2","3","4"};
Collection c=Arrays.asList(s);
System.out.println(c.remove("1") +" remove flag");
System.out.println(" collcetion "+c);
I was getting
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.AbstractList.remove(Unknown Source)
at java.util.AbstractList$Itr.remove(Unknown Source)
at java.util.AbstractCollection.remove(Unknown Source)
at test.main(test.java:26)
Can anyone help me to solve this issue?