more Observables together via a specified function and emit items based on the results of this function - http://reactivex.io/docum entation/operators/zip.ht ml /** * {@code Observable} that represents the file with the given driveId, to do that * - We create an {@code Observable} for the title * - We create an {@code Observable} for the {@code DriveContent} * - We zip the above {@code Observable} to create a final {@code File} observable * * @param {@code GoogleApiClient} the {@code GoogleApiClient} which has to do the lookup * @param driveId id of the {@code File} * @return {@code Observable} of the {@code File} with the relevant driveId */ public static Observable<File> downloadFile(final GoogleApiClient googleApiClient, DriveId driveId) { return Observable.zip(getTitleObservable(googleApiClient, driveId), getDriveContentsObservable(googleApiClient, driveId), (title, driveContents) -> { File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), title); FileUtils.copyInputStreamToFile(driveContents.getInputStream(), file); return file; }); }