title: How can I count the number of elements that match a predicate with Streams?
body: <p>In Java7 I have this code:</p>
  
  <pre><code>public int getPlayersOnline() {
      int count = 0;
      for (Player player : players) {
          if (player.isActive()) {
              count++;
          }
      }
      return count;
  }
  </code></pre>
  
  <p>I'm trying to use Java 8 features as much as possible, how can I go about improving this with lambdas?</p>