lovelle commented on a change in pull request #3962: Feature / Interceptor for 
negative ack redelivery
URL: https://github.com/apache/pulsar/pull/3962#discussion_r277069957
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerInterceptors.java
 ##########
 @@ -62,9 +63,9 @@ public ConsumerInterceptors(List<ConsumerInterceptor<T>> 
interceptors) {
      */
     public Message<T> beforeConsume(Consumer<T> consumer, Message<T> message) {
         Message<T> interceptorMessage = message;
-        for (int i = 0; i < interceptors.size(); i++) {
+        for (ConsumerInterceptor<T> interceptor : interceptors) {
 
 Review comment:
   Sorry, I tend to focus in readability in this kind of cases. Instead of 
previous for by index, what do you think of optimized index size for loop 
(prevents computing .size() for each iteration) ? :
   
   ```java
   for (int i = 0, interceptorsSize = interceptors.size(); i < 
interceptorsSize; i++) {}
   ```
   
   If you still don't agree I will rollback this :+1: 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to