title: Find all the indexes of an item within a list using stream API
body: <p>I am trying sequential search using Java 8 streams and lambda expressions. Here is my code</p>
  
  <pre><code>List&lt;Integer&gt; list = Arrays.asList(10, 6, 16, 46, 5, 16, 7);
  int search = 16;
  list.stream().filter(p -&gt; p == search).forEachOrdered(e -&gt; System.out.println(list.indexOf(e)));
  </code></pre>
  
  
  
  <pre><code>Output: 2
          2
  </code></pre>
  
  <p>I know <code>list.indexOf(e)</code> always prints the index of the first occurrence. How do I print all the indexes?</p>