-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8u231
A DESCRIPTION OF THE PROBLEM :
Hi Team,
I found an undesirable behavior of "default boolean removeIf(Predicate<? super E> filter)" method of java.util.Collection interface.
1. If the operation is performed over ArrayList data structure by adding elements thru List add() method i.e. "list.add("ABC");", execution like below works fine.
List<String> list = new ArrayList<String>();
list.add("ABC");
list.add("BBC");
list.add("CCD");
list.removeIf(n -> (n.charAt(0) == 'B'));
Result: (as expected)
ABC
CCD
2. If list is updated with Array.asList() operation, it throws exception.
List<String> list = new ArrayList<String>();
list = Arrays.asList("ABC","BBC","CCD");
list.removeIf(n -> (n.charAt(0) == 'B'));
Result: Exception in thread "main" java.lang.UnsupportedOperationException
REGRESSION : Last worked in version 8u231
ACTUAL -
Exception in thread "main" java.lang.UnsupportedOperationException
FREQUENCY : always
Hi Team,
I found an undesirable behavior of "default boolean removeIf(Predicate<? super E> filter)" method of java.util.Collection interface.
1. If the operation is performed over ArrayList data structure by adding elements thru List add() method i.e. "list.add("ABC");", execution like below works fine.
List<String> list = new ArrayList<String>();
list.add("ABC");
list.add("BBC");
list.add("CCD");
list.removeIf(n -> (n.charAt(0) == 'B'));
Result: (as expected)
ABC
CCD
2. If list is updated with Array.asList() operation, it throws exception.
List<String> list = new ArrayList<String>();
list = Arrays.asList("ABC","BBC","CCD");
list.removeIf(n -> (n.charAt(0) == 'B'));
Result: Exception in thread "main" java.lang.UnsupportedOperationException
REGRESSION : Last worked in version 8u231
ACTUAL -
Exception in thread "main" java.lang.UnsupportedOperationException
FREQUENCY : always