Closed PiYun01 closed 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()); } }); }
你好,由于对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());
}
});
}