Print list items with Java streams

You have to decide. When you want to modify the list, you can’t combine the operations. You need two statements then.

myList.replaceAll(String::toUpperCase);// modifies the list

If you just want to map values before printing without modifying the list, you’ll have to use a Stream:;

Leave a Comment