RxAndroidフィルターObservable <List <Item >>

バレンティン

RxAndroidを使用していますが、の結果をフィルタリングしたいと思いObservable<List<Item>>ます。

コードは次のとおりです。

Observable<List<Item>> observable = 
Observable.create((Observable.OnSubscribe<List<Item>>) subscriber -> {
        subscriber.onNext(ItemManager.getItems());
        subscriber.onCompleted();
    });

.filter()有効なアイテムのみを取得するために使用たいと思います。これを行うことは完璧でしょう:

observable.filter(new Func1<Item, Boolean>() {
    @Override
        public Boolean call(Item item) {
            return item.isValid();
    }
});

ただし、.filter()新しいFunc1()を実装する必要があります。

observable.filter(new Func1<List<Item>, Boolean>() {
        @Override
            public Boolean call(Item item) {
        }
    });

誰かが問題を解決する方法を知っていますか?

前もって感謝します :)

Geralt_Encore
     Observable.defer(() -> Observable.just(ItemManager.getItems())
            .subscribeOn(Schedulers.io())
            .flatMapIterable(items -> items)
            .filter(item -> item.isValid())
            .toList();

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Single <List <Item >>をObservable <Item>に変換しますか?

分類Dev

find item inside list of list

分類Dev

Adding a list item to an unordered list

分類Dev

Check if item is in list

分類Dev

hardcode item to list in oracle

分類Dev

Python not finding item in list

分類Dev

Angular 2:md-list-itemでルーターを渡す方法は?

分類Dev

Webのフラッター、List <dynamic>をList <Item>に変換する方法は?

分類Dev

Get previous/next item of a given item in a List<>

分類Dev

List<T>.Remove(T item) removing item from original List

分類Dev

Item is not getting visible in Flat list

分類Dev

Getting the index of the min item on a list

分類Dev

Display the only first item of a list

分類Dev

LitElement remove item from list

分類Dev

Setting fillStyle to a list item not working?

分類Dev

Adding an item to a list,from the keyboard

分類Dev

Multiple checkboxes in list item android

分類Dev

Find duplicate item in unordered list

分類Dev

QCombobox transparent item list stylesheet

分類Dev

simple_list_item_1を解決できないか、フィールドではありません

分類Dev

python list indices of repeated item in list

分類Dev

Breadcrumb selector for list items with a list item beside

分類Dev

Linq, Joining a list to last item in another list

分類Dev

RxJava2:ObservableでのList <Object>のフィルタリング

分類Dev

List <Item>からMap <Type、List <Item >>、ソートキー、ソート値、およびプロセス

分類Dev

Is there a way to make a list of a list then remove the first item in that list?

分類Dev

SharePointディレクトリの「list-item」を更新する方法

分類Dev

Python:if any( "str" in item for item in list)の使い方は?

分類Dev

Clicking a list view item and passing a database item ID to the next activity?

Related 関連記事

  1. 1

    Single <List <Item >>をObservable <Item>に変換しますか?

  2. 2

    find item inside list of list

  3. 3

    Adding a list item to an unordered list

  4. 4

    Check if item is in list

  5. 5

    hardcode item to list in oracle

  6. 6

    Python not finding item in list

  7. 7

    Angular 2:md-list-itemでルーターを渡す方法は?

  8. 8

    Webのフラッター、List <dynamic>をList <Item>に変換する方法は?

  9. 9

    Get previous/next item of a given item in a List<>

  10. 10

    List<T>.Remove(T item) removing item from original List

  11. 11

    Item is not getting visible in Flat list

  12. 12

    Getting the index of the min item on a list

  13. 13

    Display the only first item of a list

  14. 14

    LitElement remove item from list

  15. 15

    Setting fillStyle to a list item not working?

  16. 16

    Adding an item to a list,from the keyboard

  17. 17

    Multiple checkboxes in list item android

  18. 18

    Find duplicate item in unordered list

  19. 19

    QCombobox transparent item list stylesheet

  20. 20

    simple_list_item_1を解決できないか、フィールドではありません

  21. 21

    python list indices of repeated item in list

  22. 22

    Breadcrumb selector for list items with a list item beside

  23. 23

    Linq, Joining a list to last item in another list

  24. 24

    RxJava2:ObservableでのList <Object>のフィルタリング

  25. 25

    List <Item>からMap <Type、List <Item >>、ソートキー、ソート値、およびプロセス

  26. 26

    Is there a way to make a list of a list then remove the first item in that list?

  27. 27

    SharePointディレクトリの「list-item」を更新する方法

  28. 28

    Python:if any( "str" in item for item in list)の使い方は?

  29. 29

    Clicking a list view item and passing a database item ID to the next activity?

ホットタグ

アーカイブ