Rxjava操作符:第4篇 Combining Observables

本文基于Rxjava 2.x版本,介绍用于操作多个 Observable 对象的操作符。

Operators that work with multiple source Observables to create a single Observable

  • And/Then/When — combine sets of items emitted by two or more Observables by means of Patternand Plan intermediaries
  • CombineLatest — when an item is emitted by either of two Observables, combine the latest item emitted by each Observable via a specified function and emit items based on the results of this function
  • Join — combine items emitted by two Observables whenever an item from one Observable is emitted during a time window defined according to an item emitted by the other Observable
  • Merge — combine multiple Observables into one by merging their emissions
  • StartWith — emit a specified sequence of items before beginning to emit the items from the source Observable
  • Switch — convert an Observable that emits Observables into a single Observable that emits the items emitted by the most-recently-emitted of those Observables
  • Zip — combine the emissions of multiple Observables together via a specified function and emit single items for each combination based on the results of this function

Rxjava操作符:第3篇 Flitering Observable

本文基于Rxjava 2.x版本,介绍用于 Observable 过滤发射项目的操作符。

Operators that selectively emit items from a source Observable.

  • Debounce — only emit an item from an Observable if a particular timespan has passed without it emitting another item

    如果特定的时间跨度已经过去而没有发出另一个项目,则只从Observable中发出一个项目

  • Distinct — suppress duplicate items emitted by an Observable

    过滤重复发射源

  • ElementAt — emit only item n emitted by an Observable

    仅发出方法中指定的发射源

  • Filter — emit only those items from an Observable that pass a predicate test

    仅发出符合过滤条件的发射源

  • First — emit only the first item, or the first item that meets a condition, from an Observable

    仅保留发射序列的第一个发射源

  • IgnoreElements — do not emit any items from an Observable but mirror its termination notification

    忽略发射序列的所有元素,只会响应 onComplete 方法

  • Last — emit only the last item emitted by an Observable

    仅保留发射序列的最后一个发射源

  • Sample — emit the most recent item emitted by an Observable within periodic time intervals

    取每个时间周期内的最后一个发射源。

  • Skip — suppress the first n items emitted by an Observable

    跳过起始位置的 n 个发射源

  • SkipLast — suppress the last n items emitted by an Observable

    跳过终点位置的 n 个发射源

  • Take — emit only the first n items emitted by an Observable

    保留起始位置的 n 个发射源

  • TakeLast — emit only the last n items emitted by an Observable

    保留终点位置的 n 个发射源

Rxjava操作符:第2篇 Transforming Observable

本文基于Rxjava 2.x版本,介绍用于变换 Observable 对象的操作符。

Operators that transform items that are emitted by an Observable.

  • Buffer — periodically gather items from an Observable into bundles and emit these bundles rather than emitting the items one at a time

    定期将Observable中的项目收集到包中并发出这些包,而不是一次发送一个项目

  • FlatMap — transform the items emitted by an Observable into Observables, then flatten the emissions from those into a single Observable

    将Observable发出的项目转换为Observables,然后将这些项目的排放量变为单个Observable

  • GroupBy — divide an Observable into a set of Observables that each emit a different group of items from the original Observable, organized by key

    将一个Observable划分为一组Observable,每个Observable从原始Observable中发出一组不同的项目,按键组织

  • Map — transform the items emitted by an Observable by applying a function to each item

    通过将函数应用于每个项目来转换Observable发出的项目

  • Scan — apply a function to each item emitted by an Observable, sequentially, and emit each successive value

    将函数应用于Observable发出的每个项目,按顺序发出每个连续的值

  • Window — periodically subdivide items from an Observable into Observable windows and emit these windows rather than emitting the items one at a time

    定期将Observable中的项目细分为Observable窗口并发出这些窗口,而不是一次发出一个项目

Rxjava操作符:第1篇 Creating Observables

本文基于Rxjava 2.x版本,介绍用于创建 Observable 对象的操作符。

Operators that originate new Observables.

  • Create — create an Observable from scratch by calling observer methods programmatically
  • Defer — do not create the Observable until the observer subscribes, and create a fresh Observable for each observer
  • Empty/Never/Throw — create Observables that have very precise and limited behavior
  • From — convert some other object or data structure into an Observable
  • Interval — create an Observable that emits a sequence of integers spaced by a particular time interval
  • Just — convert an object or a set of objects into an Observable that emits that or those objects
  • Range — create an Observable that emits a range of sequential integers
  • Repeat — create an Observable that emits a particular item or sequence of items repeatedly
  • Start — create an Observable that emits the return value of a function
  • Timer — create an Observable that emits a single item after a given delay
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×