Using checked exceptions for control flow is slow. Lets replace it with an isEmpty check.

This commit is contained in:
md_5 2013-12-09 19:21:52 +11:00
parent 4a0ae833f0
commit 73b9a7fb0d

View File

@ -353,9 +353,9 @@ public <T extends Flag<V>, V> V getFlag(T flag, LocalPlayer groupPlayer) {
lastPriority = region.getPriority(); lastPriority = region.getPriority();
} }
try { if (!needsClear.isEmpty()) {
return needsClear.values().iterator().next(); return needsClear.values().iterator().next();
} catch (NoSuchElementException e) { } else {
if (globalRegion != null) { if (globalRegion != null) {
V gFlag = globalRegion.getFlag(flag); V gFlag = globalRegion.getFlag(flag);
if (gFlag != null) return gFlag; if (gFlag != null) return gFlag;