Created
December 4, 2017 23:38
-
-
Save hiranya911/30d5794e11c5b2ce6e9dcc24903856c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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