Skip to content

Instantly share code, notes, and snippets.

@hiranya911
Last active December 4, 2017 23:39
Show Gist options
  • Save hiranya911/4375dba6cb9088497fdf497b3769c97a to your computer and use it in GitHub Desktop.
Save hiranya911/4375dba6cb9088497fdf497b3769c97a to your computer and use it in GitHub Desktop.
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
@Deprecated
public Task<List<String>> continueWithTask(Task<String> task) {
return task.continueWith(new Continuation<String, List<String>>() {
@Override
public List<String> then(Task<String> task) throws Exception {
String result = task.getResult();
return Arrays.asList(result.split(","));
}
});
}
public ApiFuture<List<String>> continueWithFuture(ApiFuture<String> future) {
return ApiFutures.transform(future, new ApiFunction<String, List<String>>() {
@Override
public List<String> apply(String result) {
return Arrays.asList(result.split(","));
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment