We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f370aaf commit 3ace4a6Copy full SHA for 3ace4a6
rxjava-core/src/main/java/rx/operators/OperationSkipLast.java
@@ -85,6 +85,18 @@ public void onError(Throwable e) {
85
86
@Override
87
public void onNext(T value) {
88
+ if (count == 0) {
89
+ // If count == 0, we do not need to put value into deque
90
+ // and remove it at once. We can emit the value
91
+ // directly.
92
+ try {
93
+ observer.onNext(value);
94
+ } catch (Throwable ex) {
95
+ observer.onError(ex);
96
+ subscription.unsubscribe();
97
+ }
98
+ return;
99
100
lock.lock();
101
try {
102
deque.offerLast(value);
0 commit comments