public static <T>void forEach(MongoIterable<T> iterable,Consumer<T> operation){
  try (MongoCursor<T> cursor=iterable.iterator()){
    while (cursor.hasNext()) {
      operation.accept(cursor.next());
    }
  }
 }

public static < T > void forEach ( MongoIterable < T > iterable , Consumer < T > operation ) { try ( MongoCursor < T > cursor = iterable . iterator ( ) ) { while ( cursor . hasNext ( ) ) { operation . accept ( cursor . next ( ) ) ; } } }
perform the given operation on each of the values in the iterable container .
