Skip to content

Commit 2dc5f28

Browse files
committed
Simplify condition in EventParser: instead of loops just compare sizes
1 parent d524d2c commit 2dc5f28

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/by/andd3dfx/refactoring/refactored/EventParser.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ public class EventParser {
2121
reflections.getSubTypesOf(IEventParser.class)
2222
.forEach(aClass -> extracted(aClass));
2323

24-
for (EventType eventType : EventType.values()) {
25-
if (!map.containsKey(eventType)) {
26-
throw new IllegalStateException("Not all values of EventType have appropriate EventParser!");
27-
}
24+
if (map.size() != EventType.values().length) {
25+
throw new IllegalStateException("Not all values of EventType have appropriate EventParser!");
2826
}
2927
}
3028

0 commit comments

Comments
 (0)