Tud*_*uca 5 android rx-java retrofit
我使用Retrofit与REST API交互,RxJava操作我收到的数据.
在下面的代码片段中,我进行了API调用,并使用map运算符保存我收到的数据,然后继续对流进行其他操作.
retrofitApi.registerDevice(mDevice)
.map(new Func1<Device, Device>() {
@Override
public Device call(Device device) {
// The only purpose of the map() operator
// is to save the received device.
magicBox.saveDeviceId(device.getId());
return device;
}
})
.otherOperations()...
Run Code Online (Sandbox Code Playgroud)
我的问题是:这个工作有更好的操作员吗?我觉得我误用了map操作员.
| 归档时间: |
|
| 查看次数: |
462 次 |
| 最近记录: |