title: How can I throw CHECKED exceptions from inside Java 8 streams?
body: <p>How can I throw CHECKED exceptions from inside Java 8 streams/lambdas?</p>
  
  <p>In other words, I want to make code like this compile:</p>
  
  <pre><code>public List&lt;Class&gt; getClasses() throws ClassNotFoundException {     
  
      List&lt;Class&gt; classes = 
          Stream.of("java.lang.Object", "java.lang.Integer", "java.lang.String")
                .map(className -&gt; Class.forName(className))
                .collect(Collectors.toList());                  
      return classes;
      }
  </code></pre>
  
  <p>This code does not compile, since the <code>Class.forName()</code> method above throws <code>ClassNotFoundException</code>, which is checked.</p>
  
  <p>Please note I do NOT want to wrap the checked exception inside a runtime exception and throw the wrapped unchecked exception instead. <strong>I want to throw the checked exception itself</strong>, and without adding ugly <code>try</code>/<code>catches</code> to the stream.</p>