File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 6767 - id: java-sync
6868 content: |
6969
70- You can implement a ` ` com.mongodb.Block ` ` to print the results
71- of the iteration
70+ You can implement a ` ` java.util.function.Consumer ` ` to print the
71+ results of the iteration
7272
7373 .. code-block:: java
7474
75- Block< Document> printBlock = new Block<Document> () {
76- @Override
77- public void apply(final Document document) {
78- System.out.println(document.toJson ());
75+ Consumer< Document> printConsumer = new Consumer<> () {
76+ public void accept(final Document doc) {
77+ System.out.println(doc.toJson ());
7978 }
8079 };
8180
8281 Then iterate the cursor for documents, passing the
83- ` ` printBlock ` ` as a parameter.
82+ ` ` printConsumer ` ` as a parameter.
8483
8584 .. code-block:: java
8685
87- findIterable.forEach(printBlock );
86+ findIterable.forEach(printConsumer );
8887
8988 - id: nodejs
9089 content: |
You can’t perform that action at this time.
0 commit comments