title: Java 8 stream map reusing assigned variable
body: <p>I'm aware that title may be a little confusing but I couldn't come up with a better one so let me explain what I mean...</p>
  
  <p>I have this piece of code:</p>
  
  <pre><code>int spacing = Integer.MAX_VALUE;
  
  for (Edge edge : edges) {
      if (!union.connected(edge.getStart(), edge.getEnd())) {
          spacing = Math.min(spacing, edge.getWeight());
      }
  }
  </code></pre>
  
  <p>Is there a way to turn this code into java 8 code?</p>
  
  <p>Of course, first step is filtering which is simple, but then it becomes tricker because I would have to reuse computed variable <code>spacing</code> in Stream::map method and I have no idea is that possible.</p>