In Java7 I have this code:
public int getPlayersOnline() {
int count = 0;
for (Player player : players) {
if (player.isActive()) {
count++;
}
}
return count;
}
I'm trying to use Java 8 features as much as possible, how can I go about improving this with lambdas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…