forked from External/mage
Creating new ArrayList is unneccesarry
We shouldn't create new arraylist with default size and no element in it to show that no elements found in database. It's one more object in heap, which will be never used. There is special method Collections.emptyList() - it's more readeable and returns empty immutable list
This commit is contained in:
parent
e22951c68e
commit
2e83930ace
6 changed files with 67 additions and 66 deletions
|
|
@ -1,14 +1,16 @@
|
|||
package mage.target.targetpointer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class FixedTarget implements TargetPointer {
|
||||
|
||||
private final UUID targetId;
|
||||
|
|
@ -76,7 +78,7 @@ public class FixedTarget implements TargetPointer {
|
|||
if (this.zoneChangeCounter > 0) { // will be zero if not defined in init
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null && card.getZoneChangeCounter(game) != this.zoneChangeCounter) {
|
||||
return new ArrayList<>(); // return empty
|
||||
return Collections.emptyList(); // return empty
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue