You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rxjava-core/src/main/java/rx/internal/operators/NotificationLite.java
+12-14Lines changed: 12 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -31,8 +31,6 @@
31
31
* It's implemented as a singleton to maintain some semblance of type safety that is completely
32
32
* non-existent.
33
33
*
34
-
* @author gscampbell
35
-
*
36
34
* @param <T>
37
35
*/
38
36
publicfinalclassNotificationLite<T> {
@@ -89,8 +87,7 @@ public Object completed() {
89
87
}
90
88
91
89
/**
92
-
* Create a lite onError notification. This call does new up an object to wrap the
93
-
* {@link Throwable} but since there should only be one of these the performance impact should
90
+
* Create a lite onError notification. This call does new up an object to wrap the {@link Throwable} but since there should only be one of these the performance impact should
94
91
* be small. Can be unwrapped and sent with the {@link #accept} method.
95
92
*
96
93
* @param e
@@ -106,25 +103,27 @@ public Object error(Throwable e) {
106
103
* @param o
107
104
* the {@link Observer} to call onNext, onCompleted or onError.
108
105
* @param n
106
+
* @return true if the n was a termination event
109
107
* @throws IllegalArgumentException
110
108
* if the notification is null.
111
109
* @throws NullPointerException
112
110
* if the {@link Observer} is null.
113
111
*/
114
112
@SuppressWarnings("unchecked")
115
-
publicvoidaccept(Observer<? superT> o, Objectn) {
113
+
publicbooleanaccept(Observer<? superT> o, Objectn) {
116
114
if (n == ON_COMPLETED_SENTINEL) {
117
115
o.onCompleted();
118
-
} else
119
-
if (n == ON_NEXT_NULL_SENTINEL) {
116
+
returntrue;
117
+
} elseif (n == ON_NEXT_NULL_SENTINEL) {
120
118
o.onNext(null);
121
-
} else
122
-
if (n != null) {
119
+
returnfalse;
120
+
} elseif (n != null) {
123
121
if (n.getClass() == OnErrorSentinel.class) {
124
-
o.onError(((OnErrorSentinel)n).e);
125
-
} else {
126
-
o.onNext((T)n);
122
+
o.onError(((OnErrorSentinel) n).e);
123
+
returntrue;
127
124
}
125
+
o.onNext((T) n);
126
+
returnfalse;
128
127
} else {
129
128
thrownewIllegalArgumentException("The lite notification can not be null");
130
129
}
@@ -139,8 +138,7 @@ public boolean isError(Object n) {
139
138
}
140
139
141
140
/**
142
-
* If there is custom logic that isn't as simple as call the right method on an {@link Observer}
143
-
* then this method can be used to get the {@link rx.Notification.Kind}
141
+
* If there is custom logic that isn't as simple as call the right method on an {@link Observer} then this method can be used to get the {@link rx.Notification.Kind}
0 commit comments