code: public ApiFuture<Boolean> existsAsync(String instanceId) {
      ApiFuture<Instance> protoFuture = getInstanceAsync(instanceId);
  
      ApiFuture<Boolean> existsFuture =
          ApiFutures.transform(
              protoFuture,
              new ApiFunction<Instance, Boolean>() {
                @Override
                public Boolean apply(Instance ignored) {
                  return true;
                }
              },
              MoreExecutors.directExecutor());
  
      return ApiFutures.catching(
          existsFuture,
          NotFoundException.class,
          new ApiFunction<NotFoundException, Boolean>() {
            @Override
            public Boolean apply(NotFoundException ignored) {
              return false;
            }
          },
          MoreExecutors.directExecutor());
    }
docs: Asynchronously checks if the instance specified by the instanceId exists
  
  <p>Sample code:
  
  <pre>{@code
  ApiFuture<Boolean> found = client.existsAsync("my-instance");
  
  ApiFutures.addCallback(
  found,
  new ApiFutureCallback<Boolean>() {
  public void onSuccess(Boolean found) {
  if (found) {
  System.out.println("Instance exists");
  } else {
  System.out.println("Instance not found");
  }
  }
  
  public void onFailure(Throwable t) {
  t.printStackTrace();
  }
  },
  MoreExecutors.directExecutor()
  );
  }</pre>