简体   繁体   中英

Delete/Discard the last data value from an Observable in RxJava

I got stuck in a situation where I need to discard or delete the last data from an Observable stream, been trying for a while but can't seem to find a solution. I know you can use Async Subject to get the last item but I actually need to do totally opposite of it. Any hints will be helpful

According to documentation, you can use Observable.skipLast() to solve that problem. It can take number of items to skip and produces Observable , that don't emits that particular number of last items.

More information you can find in RxJava docs and reactive specification

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM