public static WriteConcernResult acknowledged(final int count, final boolean isUpdateOfExisting, @Nullable final BsonValue upsertedId) {
        return new WriteConcernResult() {
            @Override
            public boolean wasAcknowledged() {
                return true;
            }

            @Override
            public int getCount() {
                return count;
            }

            @Override
            public boolean isUpdateOfExisting() {
                return isUpdateOfExisting;
            }

            @Override
            @Nullable
            public BsonValue getUpsertedId() {
                return upsertedId;
            }

            @Override
            public boolean equals(final Object o) {
                if (this == o) {
                    return true;
                }
                if (o == null || getClass() != o.getClass()) {
                    return false;
                }

                WriteConcernResult that = (WriteConcernResult) o;
                if (!that.wasAcknowledged()) {
                    return false;
                }

                if (count != that.getCount()) {
                    return false;
                }
                if (isUpdateOfExisting != that.isUpdateOfExisting()) {
                    return false;
                }
                if (upsertedId != null ? !upsertedId.equals(that.getUpsertedId()) : that.getUpsertedId() != null) {
                    return false;
                }

                return true;
            }

            @Override
            public int hashCode() {
                int result = count;
                result = 31 * result + (isUpdateOfExisting ? 1 : 0);
                result = 31 * result + (upsertedId != null ? upsertedId.hashCode() : 0);
                return result;
            }

            @Override
            public String toString() {
                return "AcknowledgedWriteResult{"
                       + "count=" + count
                       + ", isUpdateOfExisting=" + isUpdateOfExisting
                       + ", upsertedId=" + upsertedId
                       + '}';
            }
        };
    }
public static WriteConcernResult acknowledged(final int count, final boolean isUpdateOfExisting, @Nullable final BsonValue upsertedId) {
        return new WriteConcernResult() {
            @Override
            public boolean wasAcknowledged() {
                return true;
            }

            @Override
            public int getCount() {
                return count;
            }

            @Override
            public boolean isUpdateOfExisting() {
                return isUpdateOfExisting;
            }

            @Override
            @Nullable
            public BsonValue getUpsertedId() {
                return upsertedId;
            }

            @Override
            public boolean equals(final Object o) {
                if (this == o) {
                    return true;
                }
                if (o == null || getClass() != o.getClass()) {
                    return false;
                }

                WriteConcernResult that = (WriteConcernResult) o;
                if (!that.wasAcknowledged()) {
                    return false;
                }

                if (count != that.getCount()) {
                    return false;
                }
                if (isUpdateOfExisting != that.isUpdateOfExisting()) {
                    return false;
                }
                if (upsertedId != null ? !upsertedId.equals(that.getUpsertedId()) : that.getUpsertedId() != null) {
                    return false;
                }

                return true;
            }

            @Override
            public int hashCode() {
                int result = count;
                result = 31 * result + (isUpdateOfExisting ? 1 : 0);
                result = 31 * result + (upsertedId != null ? upsertedId.hashCode() : 0);
                return result;
            }

            @Override
            public String toString() {
                return "AcknowledgedWriteResult{"
                       + "count=" + count
                       + ", isUpdateOfExisting=" + isUpdateOfExisting
                       + ", upsertedId=" + upsertedId
                       + '}';
            }
        };
    }
public static WriteConcernResult acknowledged ( final int count , final boolean isUpdateOfExisting , @ Nullable final BsonValue upsertedId ) { return new WriteConcernResult ( ) { @ Override public boolean wasAcknowledged ( ) { return true ; } @ Override public int getCount ( ) { return count ; } @ Override public boolean isUpdateOfExisting ( ) { return isUpdateOfExisting ; } @ Override @ Nullable public BsonValue getUpsertedId ( ) { return upsertedId ; } @ Override public boolean equals ( final Object o ) { if ( this == o ) { return true ; } if ( o == null || getClass ( ) != o . getClass ( ) ) { return false ; } WriteConcernResult that = ( WriteConcernResult ) o ; if ( ! that . wasAcknowledged ( ) ) { return false ; } if ( count != that . getCount ( ) ) { return false ; } if ( isUpdateOfExisting != that . isUpdateOfExisting ( ) ) { return false ; } if ( upsertedId != null ? ! upsertedId . equals ( that . getUpsertedId ( ) ) : that . getUpsertedId ( ) != null ) { return false ; } return true ; } @ Override public int hashCode ( ) { int result = count ; result = 31 * result + ( isUpdateOfExisting ? 1 : 0 ) ; result = 31 * result + ( upsertedId != null ? upsertedId . hashCode ( ) : 0 ) ; return result ; } @ Override public String toString ( ) { return "AcknowledgedWriteResult{" + "count=" + count + ", isUpdateOfExisting=" + isUpdateOfExisting + ", upsertedId=" + upsertedId + ' ' ; } } ; }
Create an acknowledged WriteConcernResult

@param count the count of matched documents
@param isUpdateOfExisting whether an existing document was updated
@param upsertedId if an upsert resulted in an inserted document, this is the _id of that document.  This may be null
@return an acknowledged WriteConcernResult
Create an acknowledged WriteConcernResult