activemq icon indicating copy to clipboard operation
activemq copied to clipboard

AMQ-9550 for loop can be replaced with enhanced for connection manager adapter

Open levrun opened this issue 1 year ago • 3 comments

What problems does this PR solve?

Iteration over collections or arrays  can be replaced with an enhanced for loop (foreach iteration syntax). 
See more details why : https://docs.oracle.com/javase/8/docs/technotes/guides/language/foreach.html

Why is it beneficial to merge into ActiveMQ?

The for-each construct gets rid of the clutter and the opportunity for error.
When should you use the for-each loop? Any time you can. It really beautifies your code.

How do you make sure this PR is well tested? run tests locally

levrun avatar Aug 17 '24 04:08 levrun

@jbonofre Hey JB, could you take a quick look at this PR? Thanks.

kenliao94 avatar Oct 25 '24 19:10 kenliao94

The code change is fine -- I think the ticket description and commit message could be clarified/simplified as this is just a simple modernization and not a fundamental change in loop algorithm.

Something like: activemq-ra: modernize loops to remove iterator

mattrpav avatar Oct 25 '24 19:10 mattrpav

@mattrpav Good call out.

kenliao94 avatar Nov 08 '24 18:11 kenliao94