Skip to content

Commit

Permalink
Merge pull request #298 from md-5/herd_u_like_ifs
Browse files Browse the repository at this point in the history
Using checked exceptions for control flow is slow. Lets replace it with an isEmpty check.
  • Loading branch information
TomyLobo committed Dec 9, 2013
2 parents 4a0ae83 + 73b9a7f commit 6b16ed7
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -353,9 +353,9 @@ public <T extends Flag<V>, V> V getFlag(T flag, LocalPlayer groupPlayer) {
lastPriority = region.getPriority();
}

try {
if (!needsClear.isEmpty()) {
return needsClear.values().iterator().next();
} catch (NoSuchElementException e) {
} else {
if (globalRegion != null) {
V gFlag = globalRegion.getFlag(flag);
if (gFlag != null) return gFlag;
Expand Down

0 comments on commit 6b16ed7

Please sign in to comment.