forked from External/mage
loop to streams
This commit is contained in:
parent
d42b2a6d37
commit
0cb7d8aab6
4 changed files with 67 additions and 90 deletions
|
|
@ -27,11 +27,12 @@
|
|||
*/
|
||||
package mage.abilities.condition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Combines conditions to one compound conditon, all single conditons must be
|
||||
* true to return true for the compound condtion.
|
||||
|
|
@ -55,12 +56,7 @@ public class CompoundCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (Condition condition : conditions) {
|
||||
if (!condition.apply(game, source)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return conditions.stream().allMatch(condition -> condition.apply(game, source));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue