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 67
67
- id: java-sync
68
68
content: |
69
69
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
72
72
73
73
.. code-block:: java
74
74
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 ());
79
78
}
80
79
};
81
80
82
81
Then iterate the cursor for documents, passing the
83
- ` ` printBlock ` ` as a parameter.
82
+ ` ` printConsumer ` ` as a parameter.
84
83
85
84
.. code-block:: java
86
85
87
- findIterable.forEach(printBlock );
86
+ findIterable.forEach(printConsumer );
88
87
89
88
- id: nodejs
90
89
content: |
You can’t perform that action at this time.
0 commit comments