michael-o commented on a change in pull request #272: Loop can be terminated after condition is met URL: https://github.com/apache/tomcat/pull/272#discussion_r405110647
########## File path: java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java ########## @@ -824,17 +824,23 @@ public void mapMemberAdded(Member member) { public boolean inSet(Member m, Member[] set) { if ( set == null ) return false; boolean result = false; - for (int i=0; i<set.length && (!result); i++ ) - if ( m.equals(set[i]) ) result = true; + for (int i = 0; i < set.length; i++ ) + if (m.equals(set[i])) { + result = true; + break; + } return result; } public Member[] excludeFromSet(Member[] mbrs, Member[] set) { List<Member> result = new ArrayList<>(); for (int i=0; i<set.length; i++ ) { boolean include = true; - for (int j=0; j<mbrs.length && include; j++ ) - if ( mbrs[j].equals(set[i]) ) include = false; + for (int j = 0; j < mbrs.length; j++ ) Review comment: And here.. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org