Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA weird foreach-loop warning

IntelliJ IDEA is giving me a weird "weak warning" in my code where I loop through an ArrayList:

Weird warning

From what I know this is already a foreach-loop, so I'm confused why IDEA gives me this warning. I'm assuming that this is a bug, what do you think?

When I click "more" it shows the following text -

This inspection reports foreach loops which can be replaced with stream api calls. Stream api is not available under Java 1.7 or earlier JVMs.

like image 928
MrWasdennnoch Avatar asked Nov 29 '25 01:11

MrWasdennnoch


1 Answers

IntelliJ IDEA wants to replace the loop with a Java 8 stream api forEach() call (using a lambda). I think that warning is a little unclear, but it's from the Java | Java language level migration aids | foreach loop can be collapsed with stream api inspection.

like image 156
Bas Leijdekkers Avatar answered Nov 30 '25 16:11

Bas Leijdekkers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!