Using Eclipse and Java -version 1.8
I have this code:
public Stream<Ship> remainingShips() {
return this.b.getShips().stream().filter(s -> !s.isSunk());.
}
public Stream<Ship> sunkShips() {
return this.b.getShips().stream().filter(s -> s.isSunk());.
}
I want to print out all the items in the stream, by calling
System.out.println("Sunk ships => " + this.opponent.sunkShips());
but this will just print the stream object, how can I get access to all the items in stream and print each out?