Last active
December 4, 2017 23:39
-
-
Save hiranya911/4375dba6cb9088497fdf497b3769c97a 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.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