mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
refactor: fully replace PermanentInListPredicate
with PermanentReferenceInCollectionPredicate related to #10639, #11471, the existence of this was misleading devs to use it incorrectly
This commit is contained in:
parent
c528491544
commit
4dd97b41fc
7 changed files with 30 additions and 59 deletions
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
package mage.filter.predicate.permanent;
|
||||
|
||||
import java.util.List;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public class PermanentInListPredicate implements Predicate<Permanent> {
|
||||
|
||||
private final List<Permanent> permanents;
|
||||
|
||||
public PermanentInListPredicate(List<Permanent> permanents) {
|
||||
this.permanents = permanents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
return (permanents.contains(input));
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +21,9 @@ public class PermanentReferenceInCollectionPredicate implements Predicate<Perman
|
|||
this.references = references;
|
||||
}
|
||||
public PermanentReferenceInCollectionPredicate(Collection<Permanent> permanents, Game game) {
|
||||
this.references = permanents.stream().map((p) -> new MageObjectReference(p, game))
|
||||
this.references = permanents
|
||||
.stream()
|
||||
.map(p -> new MageObjectReference(p, game))
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue