forked from External/mage
rewrote some streams and optionals
This commit is contained in:
parent
d0bf77cedf
commit
594ffa2754
29 changed files with 199 additions and 273 deletions
|
|
@ -28,10 +28,10 @@
|
|||
package mage.counters;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -122,12 +122,9 @@ public class Counters extends HashMap<String, Counter> implements Serializable {
|
|||
}
|
||||
|
||||
public List<BoostCounter> getBoostCounters() {
|
||||
List<BoostCounter> boosters = new ArrayList<>();
|
||||
for (Counter counter : this.values()) {
|
||||
if (counter instanceof BoostCounter) {
|
||||
boosters.add((BoostCounter) counter);
|
||||
}
|
||||
}
|
||||
return boosters;
|
||||
return values().stream().
|
||||
filter(counter -> counter instanceof BoostCounter).
|
||||
map(counter -> (BoostCounter) counter).
|
||||
collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue