Refactoring

See github line by line comments in 'File changed'
This commit is contained in:
vraskulin 2016-12-29 16:49:12 +03:00
parent c0cf22bbf7
commit f04ba151f7
52 changed files with 87 additions and 220 deletions

View file

@ -43,9 +43,7 @@ public class Watchers extends HashMap<String, Watcher> {
}
public Watchers(final Watchers watchers) {
watchers.entrySet().stream().forEach((entry) -> {
this.put(entry.getKey(), entry.getValue().copy());
});
watchers.entrySet().stream().forEach((entry) -> this.put(entry.getKey(), entry.getValue().copy()));
}
public Watchers copy() {
@ -59,16 +57,13 @@ public class Watchers extends HashMap<String, Watcher> {
}
public void watch(GameEvent event, Game game) {
for (Iterator<Watcher> it = this.values().iterator(); it.hasNext();) {
Watcher watcher = it.next();
for (Watcher watcher : this.values()) {
watcher.watch(event, game);
}
}
public void reset() {
this.values().stream().forEach((watcher) -> {
watcher.reset();
});
this.values().stream().forEach(Watcher::reset);
}
public Watcher get(String key, UUID id) {