When you create Stream
from List
, you are not allowed to change the source List
from Stream
, as indicated in the “Non-Intervention” in the package documentation . Failure to comply with this restriction may result in damage to the structure ConcurrentModificationException
or, even worse, damaged structure without exception.
Java - , , .. ,
IntStream.range(0, list1.size()).forEach(ix -> list1.set(ix, list1.get(ix)+1));
Stream
. ,
list1.replaceAll(i -> i + 1);
List
, Java 8, -. , , , Iterable.forEach
, Collection.removeIf
List.sort
, , Stream API. , Map
, .
. " API, - Java SE 8 " .