title: Java 8: How do I work with exception throwing methods in streams?
body: <p>Suppose I have a class and a method</p>
  
  <pre><code>class A {
    void foo() throws Exception() {
      ...
    }
  }
  </code></pre>
  
  <p>Now I would like to call foo for each instance of <code>A</code> delivered by a stream like:</p>
  
  <pre><code>void bar() throws Exception {
    Stream&lt;A&gt; as = ...
    as.forEach(a -&gt; a.foo());
  }
  </code></pre>
  
  <p>Question: How do I properly handle the exception? The code does not compile on my machine because I do not handle the possible exceptions that can be thrown by foo(). The <code>throws Exception</code> of <code>bar</code> seems to be useless here. Why is that?</p>