title: How to get element index when using a stream to traverse a list?
body: <p>I want to get index when traverse list use lambda.</p>
  
  <p>For example:</p>
  
  <pre><code>List&lt;CheckBox&gt; checkBoxes = null;
  
  checkBoxes.forEach(checkBox -&gt; {
        if (checkBox.isSelected()) {
            sb.append("index"); //I want to get checkbox index here
            sb.append(",");
        }
  });
  </code></pre>
  
  <p><strong>EDIT</strong>: The <code>checkBoxes = null;</code> is just a placeholder but will be used properly once I start writing some code.</p>