Skip to content

Commit

Permalink
avoid Iterator creation if not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ceki committed Feb 1, 2017
1 parent a464e5a commit a4ce685
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public void clearAllFilters() {
* NEUTRAL, then NEUTRAL is returned.
*/
public FilterReply getFilterChainDecision(E event) {
// avoid Iterator creation if not necessary
if(filterList.isEmpty()) {
return FilterReply.NEUTRAL;
}

for (Filter<E> f : filterList) {
final FilterReply r = f.decide(event);
if (r == FilterReply.DENY || r == FilterReply.ACCEPT) {
Expand Down

0 comments on commit a4ce685

Please sign in to comment.