Skip to content

Instantly share code, notes, and snippets.

@hiranya911
Created December 4, 2017 23:38
Show Gist options
  • Save hiranya911/30d5794e11c5b2ce6e9dcc24903856c3 to your computer and use it in GitHub Desktop.
Save hiranya911/30d5794e11c5b2ce6e9dcc24903856c3 to your computer and use it in GitHub Desktop.
import com.google.firebase.tasks.Tasks;
@Deprecated
public String waitForTask(Task<String> task) {
try {
return Tasks.await(task);
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException("Error while waiting for task", e);
}
}
public String waitForFuture(ApiFuture<String> future) {
try {
return future.get();
} catch (ExecutionException | InterruptedException e) {
throw new RuntimeException("Error while waiting for future", e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment