Giter Club home page Giter Club logo

rxjavademo's Introduction

RXJavaDemo

创建操作有:
just( ) — 将一个或多个对象转换成发射这个或这些对象的一个Observable。
from( ) — 将一个Iterable, 一个Future, 或者一个数组转换成一个Observable。
repeat( ) — 创建一个重复发射指定数据或数据序列的Observable。
repeatWhen( ) — 创建一个重复发射指定数据或数据序列的Observable,它依赖于另一个Observable发射的数据。
create( ) — 使用一个函数从头创建一个Observable。
defer( ) — 只有当订阅者订阅才创建Observable;为每个订阅创建一个新的Observable。
range( ) — 创建一个发射指定范围的整数序列的Observable。
interval( ) — 创建一个按照给定的时间间隔发射整数序列的Observable。
timer( ) — 创建一个在给定的延时之后发射单个数据的Observable。
empty( ) — 创建一个什么都不做直接通知完成的Observable。
error( ) — 创建一个什么都不做直接通知错误的Observable。
never( ) — 创建一个不发射任何数据的Observable。

变换操作有:
这个页面展示了创建Observable的各种方法。

just( ) — 将一个或多个对象转换成发射这个或这些对象的一个Observable。
from( ) — 将一个Iterable, 一个Future, 或者一个数组转换成一个Observable。
repeat( ) — 创建一个重复发射指定数据或数据序列的Observable。
repeatWhen( ) — 创建一个重复发射指定数据或数据序列的Observable,它依赖于另一个Observable发射的数据。
create( ) — 使用一个函数从头创建一个Observable。
defer( ) — 只有当订阅者订阅才创建Observable;为每个订阅创建一个新的Observable。
range( ) — 创建一个发射指定范围的整数序列的Observable。
interval( ) — 创建一个按照给定的时间间隔发射整数序列的Observable。
timer( ) — 创建一个在给定的延时之后发射单个数据的Observable。
empty( ) — 创建一个什么都不做直接通知完成的Observable。
error( ) — 创建一个什么都不做直接通知错误的Observable。
never( ) — 创建一个不发射任何数据的Observable。

过滤操作有:
map( ) — 对序列的每一项都应用一个函数来变换Observable发射的数据序列。
flatMap( ), concatMap( ), and flatMapIterable( ) — 将Observable发射的数据集合变换为Observables集合,然后将这些Observable发射的数据平坦化的放进一个单独的Observable。
switchMap( ) — 将Observable发射的数据集合变换为Observables集合,然后只发射这些Observables最近发射的数据。
scan( ) — 对Observable发射的每一项数据应用一个函数,然后按顺序依次发射每一个值。
groupBy( ) — 将Observable分拆为Observable集合,将原始Observable发射的数据按Key分组,每一个Observable发射一组不同的数据。
buffer( ) — 它定期从Observable收集数据到一个集合,然后把这些数据集合打包发射,而不是一次发射一个。
window( ) — 定期将来自Observable的数据分拆成一些Observable窗口,然后发射这些窗口,而不是每次发射一项。
cast( ) — 在发射之前强制将Observable发射的所有数据转换为指定类型。

异步的有:

Schedulers.immediate():直接在当前线程运行,相当于不知道线程,这是默认的Scheduler。
Schedulers.newThread():总是启用新线程,并在新线程执行操作。
Schedulers.io():I/O操作(读写文件,读写数据库,网络信息交互等)所使用的Scheduler。行为模式和newThread()差不多,区别在于io()的内部实现的是是用一个无数量上限的线程池,可以重用空闲的线程,因此多数情况下io()比newThread()效率更高。
Shedulers.computation():计算所使用的Scheduler。这个计算指的是cpu密集型计算,例如图形的计算这个Scheduler使用的固定的线程池,大小为cpu核数,不要把I/o操作放入,会浪费cpu的。
AndroidSchedulers.mainThread(),它指定的操作将在Android主线程运行。
subscribeOn():指定subscribe()所发生的线程,即Observable.OnSubscribe被激活时所处的线程,或者叫做时间产生的线程。
observeOn():指定subscriber所运行在的线程。或者叫做时间消费的线程。

以及Retrofit2.0网络解析以及与rxjava一起使用的网络解析。

rxjavademo's People

Contributors

httvc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.