title: Extracting sub-strings with Stream in Java
body: <p>I'm new to Streams and Lambdas in Java. I have a variable like this  -</p>
  <pre><code> List&lt;String&gt; lines = Arrays.asList(&quot;ab,12,bd&quot;,&quot;df,23,df&quot;,&quot;ef,98,dg&quot;);
  </code></pre>
  <p>I wanted these actions to happen.</p>
  <ol>
  <li><p>Split each element in the list.</p>
  </li>
  <li><p>Extract 2nd element in the resulting array. (that is numbers).</p>
  </li>
  <li><p>Apply some function on it. To make it simple, let's I wanted to multiply it by 2.</p>
  </li>
  <li><p>Then collect the result as list, that is list containing 24,46,196.</p>
  <p>I tried doing that in streams, but I'm not able to get. Any pointers will be helpful. Thank you.</p>
  </li>
  </ol>
  <p><strong>Edit:</strong> I tried this way and got result -</p>
  <pre><code>    List&lt;Integer&gt; result1 = lines.stream()
                              .map(l -&gt; l.split(&quot;,&quot;)[1])
                              .map(l-&gt;Integer.parseInt(l))
                              .collect(Collectors.toList());
  </code></pre>
  <p>And got results as</p>
  <pre><code>[12, 23, 98]
  </code></pre>
  <p>Is this is correct way of doing stream?</p>