Skip to content

Commit e5b449d

Browse files
JakeWhartonakarnokd
authored andcommitted
Cleanups from making NotificationLite stateless. (#4677)
1 parent e7bf735 commit e5b449d

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

src/main/java/rx/internal/operators/NotificationLite.java

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import java.io.Serializable;
1919

20-
import rx.Notification.Kind;
2120
import rx.Observer;
2221

2322
/**
@@ -28,15 +27,10 @@
2827
* <p>
2928
* An object is allocated inside {@link #error(Throwable)} to wrap the {@link Throwable} but this shouldn't
3029
* affect performance because exceptions should be exceptionally rare.
31-
* <p>
32-
* It's implemented as a singleton to maintain some semblance of type safety that is completely non-existent.
33-
*
34-
* @param <T> the element type
3530
*/
36-
public final class NotificationLite<T> {
31+
public final class NotificationLite {
3732

3833
private NotificationLite() {
39-
// singleton
4034
}
4135

4236
private static final Object ON_COMPLETED_SENTINEL = new Serializable() {
@@ -184,30 +178,6 @@ public static boolean isNull(Object n) {
184178
public static boolean isNext(Object n) {
185179
return n != null && !isError(n) && !isCompleted(n);
186180
}
187-
/**
188-
* Indicates which variety a particular lite notification is. If you need something more complex than
189-
* simply calling the right method on an {@link Observer} then you can use this method to get the
190-
* {@link rx.Notification.Kind}.
191-
*
192-
* @param n
193-
* the lite notification
194-
* @throws IllegalArgumentException
195-
* if the notification is null.
196-
* @return the {@link Kind} of lite notification {@code n} is: either {@code Kind.OnCompleted},
197-
* {@code Kind.OnError}, or {@code Kind.OnNext}
198-
*/
199-
public static Kind kind(Object n) {
200-
if (n == null) {
201-
throw new IllegalArgumentException("The lite notification can not be null");
202-
} else if (n == ON_COMPLETED_SENTINEL) {
203-
return Kind.OnCompleted;
204-
} else if (n instanceof OnErrorSentinel) {
205-
return Kind.OnError;
206-
} else {
207-
// value or ON_NEXT_NULL_SENTINEL but either way it's an OnNext
208-
return Kind.OnNext;
209-
}
210-
}
211181

212182
/**
213183
* Returns the item corresponding to this {@code OnNext} lite notification. Bad things happen if you pass

0 commit comments

Comments
 (0)