fix seeker/hider returning null

This commit is contained in:
Tyler Murphy 2022-11-22 15:29:39 -05:00
parent fcc3764a14
commit 3ec241766d

View file

@ -80,11 +80,11 @@ public class Board {
} }
public List<Player> getHiders() { public List<Player> getHiders() {
return Hider.stream().filter(Objects::nonNull).map(playerList::get).collect(Collectors.toList()); return Hider.stream().filter(Objects::nonNull).map(playerList::get).filter(Objects::nonNull).collect(Collectors.toList());
} }
public List<Player> getSeekers() { public List<Player> getSeekers() {
return Seeker.stream().filter(Objects::nonNull).map(playerList::get).collect(Collectors.toList()); return Seeker.stream().filter(Objects::nonNull).map(playerList::get).filter(Objects::nonNull).collect(Collectors.toList());
} }
public Player getFirstSeeker() { public Player getFirstSeeker() {
@ -92,7 +92,7 @@ public class Board {
} }
public List<Player> getSpectators() { public List<Player> getSpectators() {
return Spectator.stream().filter(Objects::nonNull).map(playerList::get).collect(Collectors.toList()); return Spectator.stream().filter(Objects::nonNull).map(playerList::get).filter(Objects::nonNull).collect(Collectors.toList());
} }
public List<Player> getPlayers() { public List<Player> getPlayers() {