This is happening as your are modifying the source of the stream which is a non-concurrent ArrayList. The ArrayListSpliterator does not have the CONCURRENT or IMMUTABLE characteristic and it does not support removal during iteration. It is not due to usage of the Collection.removeIf method.
From the docs:
A Spliterator that does not report IMMUTABLE or CONCURRENT is expected
to have a documented policy (for example throwing
ConcurrentModificationException concerning structural interference
detected during traversal.
For this to work you need to have List implementation which supports concurrent removal during iteration like a CopyOnWriteArrayList, whose Spliterator has the IMMUTABLE characteristic.
Anyway, you are not using the map operation correctly if you want to conditionally filter items from the List you should use Stream.filter instead also consider using equals while comparing String objects:
namesList.stream()
.filter(m1 -> !"AA".equals(m1))
.forEach(System.out::println);
namesList.remove("AA")==. Never do that. Useequals()instead.Collections.synchronizedCollection(namesList);