JsonChao / Awesome-WanAndroid

:zap:致力于打造一款极致体验的 http://www.wanandroid.com/ 客户端,知识和美是可以并存的哦QAQn(*≧▽≦*)n
Apache License 2.0
2.73k stars 605 forks source link

lambda 代码还原 #39

Closed PiYun01 closed 6 years ago

PiYun01 commented 6 years ago

你好,由于对lambda 和rxjava不是很熟练,统一返回结果处理一直不知道怎么还原为普通java代码 public static ObservableTransformer<BaseResponse, T> handleResult() { return httpResponseObservable -> httpResponseObservable.flatMap((Function<BaseResponse, Observable>) baseResponse -> { if(baseResponse.getErrorCode() == BaseResponse.SUCCESS && baseResponse.getData() != null && CommonUtils.isNetworkConnected()) { return createData(baseResponse.getData()); } else { return Observable.error(new OtherException()); } }); }