I'm passing a lambda expression as an argument to a method, and I want to modify a variable that is defined *outside* of the lambda expression.

I've tried a few things. Currently, I have an `AtomicBoolean` called `success`. Within the lambda expression, I'm calling `success.set(true)`. However, when I log the value of the `success` variable, it's still `false` and doesn't seem to be updating.

Basically, I'm calling a function with a void return type and need to know if the function was successful.

What am I doing wrong?

Here's the code:

```java
public void createUser(String email, String password) {
    AtomicBoolean success = new AtomicBoolean(false);
    Amplify.Auth.signUp(
        email,
        password,
        AuthSignUpOptions.builder()
            .userAttribute(AuthUserAttributeKey.email(), email)
            .build(),
        result -> success.set(true),
        error -> Log.e("AuthQuickStart", "Sign up failed", error)
    );
    Log.d("success", String.valueOf(success.get()));
}

```