From 3ec241766def153204aa995de43279176847e929 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Tue, 22 Nov 2022 15:29:39 -0500 Subject: [PATCH] fix seeker/hider returning null --- src/main/java/net/tylermurphy/hideAndSeek/game/Board.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java index 1873fd4..8c26bc8 100644 --- a/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java +++ b/src/main/java/net/tylermurphy/hideAndSeek/game/Board.java @@ -80,11 +80,11 @@ public class Board { } public List 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 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() { @@ -92,7 +92,7 @@ public class Board { } public List 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 getPlayers() {