Reputation: 1631
I am trying to understand how the asynch java driver for mongodb works from this example:
collection.insertOne(doc, new SingleResultCallback<Void>() {
@Override
public void onResult(final Void result, final Throwable t) {
System.out.println("Inserted!");
}
});
Upvotes: 0
Views: 566
Reputation: 8676
Functional interface is a concept introduced in Java 8. Basically it is an interface with only one method's declaration (except the default and static methods). See details in What is use of Functional Interface in Java 8?.
According to mongodb documentation the method is invoked when the operation is competed.
Within this structure you have result
instance that you can operate with if it is not null
.
Upvotes: 1