<commit_before><commit_msg>use "get" method to wait<commit_after>import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

class CompletableFutureExample {

  public static class UserName {
    private String name;

    public void setName(String name) {
      this.name = name;
    }

    public String getName() {
      return name;
    }
  }

  public static class UserPhone {
    private String phone;

    public void setPhone(String phone) {
      this.phone = phone;
    }

    public String getPhone() {
       return phone;
    }
  }

  public static void main(String[] args) throws Exception {

    CompletableFuture<UserName> userName = CompletableFuture.supplyAsync(() ->
      {
        System.out.println("Creating name");
        return new UserName();
      }
    ).thenComposeAsync((UserName name) -> CompletableFuture.supplyAsync(() ->
      {
        try {
          Thread.sleep(1000); // sleep to show async behavior
        } catch (InterruptedException e) {

        }

        System.out.println("Populating name");
        name.setName("Bill");
        return name;
      }
    ));

    CompletableFuture<UserPhone> userPhone = CompletableFuture.supplyAsync(() ->
      {
        System.out.println("Creating phone");
        return new UserPhone();
      }
    ).thenComposeAsync((UserPhone phone) -> CompletableFuture.supplyAsync(() ->
      {
        System.out.println("Populating phone");
        phone.setPhone("800-000-1234");
        return phone;
      }
    ));

    UserName name = userName.get(1500, TimeUnit.MILLISECONDS);
    UserPhone phone = userPhone.get();

    System.out.println("Done! name: " + name.getName() + " phone: " + phone.getPhone());
  }
}
{'fraction_non_alphanumeric': 0.12013929193267557, 'fraction_numerical': 0.01044689495066744, 'mean_word_length': 2.540041067761807, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2994492', 'n_tokens_mistral': 520, 'n_tokens_neox': 492, 'n_words': 107}