This link says that I can remove a string by directly addressing it with the parameter, like:
myList.remove("myString");
but trying to do this I get the java.lang.UnsupportedOperationException exception.
UPDATE The code I use to create and fill the list:
List<String> myList = new ArrayList<>(myArray.length);
for (String str : myArray) {
myList.add(str);
}
The code I get the exception while executing:
if (myList.contains("specificString"))
myList.remove("specificString");
}
How can I remove this element then without using the for loop or an index?