title: Getting sublist from a Java list with nth elements that fulfills a condition with streams
body: <p>I have a very simple use case </p>
  
  <p>Given a list of letters with A and Bs, I want to get the sublist that contains the first N Bs, for example:</p>
  
  <ul>
  <li>f(3, [A A A B A B A B A A]) = [A A A B A B A B]         </li>
  <li>f(2, [A A A B A B A B A A]) = [A A A B A B]</li>
  <li>f(1, [A A B A B A]) = [A A B]</li>
  <li>f(0, [A A B A B]) = []</li>
  </ul>
  
  <p>By following an imperative approach, this is relatively easy, count until we find N Bs, and then get the sublist until that position.</p>
  
  <p>However, I couldn't find any functional solution with lambdas, since the operation on every node seems to be independent from the others (which I guess make sense for parallelization).</p>