title: Java syntax with MongoDB
body: <p>I'm going through the intro to MongoDB for java. There's some example code to retrieve all the documents in a collection. The code works, but I find it a bit...clunky for lack of a better word. I'm wondering if there's a specific reason that makes it necessary. The given example is:</p>
  
  <pre><code>FindIterable&lt;Document&gt; iterable = db.getCollection("restaurants").find();
  iterable.forEach(new Block&lt;Document&gt;() {
      @Override
      public void apply(final Document document) {
          System.out.println(document);
      }
  });
  </code></pre>
  
  <p>Is there some reason a <code>Block</code> instance has to be created in every iteration of the <code>forEach</code> in the above example? Why not something a little more straightforward like:</p>
  
  <pre><code>FindIterable&lt;Document&gt; iterable = db.getCollection("restaurants").find();
  for (Document document : iterable) {
      System.out.println(document);
  }
  </code></pre>