当前位置: 首页>>代码示例>>Java>>正文


Java Flowable.defer方法代码示例

本文整理汇总了Java中io.reactivex.Flowable.defer方法的典型用法代码示例。如果您正苦于以下问题:Java Flowable.defer方法的具体用法?Java Flowable.defer怎么用?Java Flowable.defer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.reactivex.Flowable的用法示例。


在下文中一共展示了Flowable.defer方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import io.reactivex.Flowable; //导入方法依赖的package包/类
private static Flowable<SqsMessage> get(AmazonSQS sqs, String queueName, Optional<String> bucketName,
        Optional<AmazonS3> s3, Service service, int waitTimeSeconds) {
    return Flowable.defer(() -> {
        final String queueUrl = sqs.getQueueUrl(queueName).getQueueUrl();
        return Flowable.just(sqs.receiveMessage(request(queueName, waitTimeSeconds)) //
                .getMessages() //
                .stream() //
                .map(m -> Sqs.getNextMessage(m, queueUrl, bucketName, s3, sqs, service)) //
                .collect(Collectors.toList())) //
                .concatWith(Flowable.defer(() -> Flowable.just(sqs.receiveMessage(request(queueName, 0)) //
                        .getMessages() //
                        .stream() //
                        .map(m -> Sqs.getNextMessage(m, queueUrl, bucketName, s3, sqs, service)) //
                        .collect(Collectors.toList()))) //
                        .repeat())
                .takeWhile(list -> !list.isEmpty()) //
                .flatMapIterable(x -> x) //
                .filter(opt -> opt.isPresent()).map(opt -> opt.get());
    });//
}
 
开发者ID:davidmoten,项目名称:rxjava2-aws,代码行数:21,代码来源:Sqs.java

示例2: getUsers

import io.reactivex.Flowable; //导入方法依赖的package包/类
@Override
public Flowable<List<UserEntity>> getUsers() {
    return Flowable.defer(() -> Flowable.just(mUserDatabase.localUserDao().getUsers())
            .map(users -> {
                List<UserEntity> list = new ArrayList<>();
                for (User user : users) {
                    list.add(this.mUserEntityMapper.mapFromLocalStorage(user));
                }
                return list;
            }));
}
 
开发者ID:amitkma,项目名称:android-architecture-boilerplate,代码行数:12,代码来源:UserLocalRepositoryImpl.java

示例3: getResizedFileAsFlowable

import io.reactivex.Flowable; //导入方法依赖的package包/类
public Flowable<File> getResizedFileAsFlowable() {
    return Flowable.defer(new Callable<Flowable<File>>() {
        @Override
        public Flowable<File> call() {
            try {
                return Flowable.just(getResizedFile());
            } catch (IOException e) {
                return Flowable.error(e);
            }
        }
    });
}
 
开发者ID:hkk595,项目名称:Resizer,代码行数:13,代码来源:Resizer.java

示例4: getResizedBitmapAsFlowable

import io.reactivex.Flowable; //导入方法依赖的package包/类
public Flowable<Bitmap> getResizedBitmapAsFlowable() {
    return Flowable.defer(new Callable<Flowable<Bitmap>>() {
        @Override
        public Flowable<Bitmap> call() {
            try {
                return Flowable.just(getResizedBitmap());
            } catch (IOException e) {
                return Flowable.error(e);
            }
        }
    });
}
 
开发者ID:hkk595,项目名称:Resizer,代码行数:13,代码来源:Resizer.java

示例5: compressToFileAsFlowable

import io.reactivex.Flowable; //导入方法依赖的package包/类
public Flowable<File> compressToFileAsFlowable(final File imageFile, final String compressedFileName) {
    return Flowable.defer(() -> {
        try {
            return Flowable.just(compressToFile(imageFile, compressedFileName));
        } catch (IOException e) {
            return Flowable.error(e);
        }
    });
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:10,代码来源:Compressor.java

示例6: compressToBitmapAsFlowable

import io.reactivex.Flowable; //导入方法依赖的package包/类
public Flowable<Bitmap> compressToBitmapAsFlowable(final File imageFile) {
    return Flowable.defer(() -> {
        try {
            return Flowable.just(compressToBitmap(imageFile));
        } catch (IOException e) {
            return Flowable.error(e);
        }
    });
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:10,代码来源:Compressor.java

示例7: clearData

import io.reactivex.Flowable; //导入方法依赖的package包/类
public Flowable<Boolean> clearData(String tag) {
    return Flowable.defer(() -> {
        if (sharedPreferences != null) {
            sharedPreferences.edit().remove(tag).apply();
            return Flowable.just(true);
        }
        return Flowable.just(false);
    });
}
 
开发者ID:codenergic,项目名称:theskeleton-ui-android,代码行数:10,代码来源:AbstractPreferences.java

示例8: clearAllData

import io.reactivex.Flowable; //导入方法依赖的package包/类
public Flowable<Boolean> clearAllData() {
    return Flowable.defer(() -> {
        if (sharedPreferences != null) {
            sharedPreferences.edit().clear().apply();
            return Flowable.just(true);
        }
        return Flowable.just(false);
    });
}
 
开发者ID:codenergic,项目名称:theskeleton-ui-android,代码行数:10,代码来源:AbstractPreferences.java

示例9: getAllImages

import io.reactivex.Flowable; //导入方法依赖的package包/类
public static Flowable getAllImages(HashMap<String, Object> param) {
    HashMap<String, String> map = new HashMap<>();
    map.put(C.TYPE, (String) param.get(C.TYPE));
    return Flowable.defer(() -> RealmHelper.getRealmItems(ImageInfo.class, map));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:DbFactory.java

示例10: getCommentList

import io.reactivex.Flowable; //导入方法依赖的package包/类
public static Flowable getCommentList(HashMap<String, Object> param) {
    HashMap<String, String> map = new HashMap<>();
    map.put("article.objectId", (String) param.get(C.OBJECT_ID));
    return Flowable.defer(() -> RealmHelper.getRealmItems(CommentInfo.class, map));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:DbFactory.java

示例11: getAllUser

import io.reactivex.Flowable; //导入方法依赖的package包/类
public static Flowable getAllUser(HashMap<String, Object> param) {
    return Flowable.defer(() -> RealmHelper.getRealmItems(_User.class, null));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:DbFactory.java

示例12: getUserCommentList

import io.reactivex.Flowable; //导入方法依赖的package包/类
public static Flowable getUserCommentList(HashMap<String, Object> param) {
    HashMap<String, String> map = new HashMap<>();
    map.put("creater.objectId", (String) param.get(C.OBJECT_ID));
    return Flowable.defer(() -> RealmHelper.getRealmItems(CommentInfo.class, map));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:DbFactory.java

示例13: getMessageList

import io.reactivex.Flowable; //导入方法依赖的package包/类
public static Flowable getMessageList(HashMap<String, Object> param) {
    HashMap<String, String> map = new HashMap<>();
    map.put(C.UID, (String) param.get(C.UID));
    return Flowable.defer(() -> RealmHelper.getRealmItems(MessageInfo.class, map));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:DbFactory.java


注:本文中的io.reactivex.Flowable.defer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。