|
17 | 17 |
|
18 | 18 | import java.io.Serializable; |
19 | 19 |
|
20 | | -import rx.Notification.Kind; |
21 | 20 | import rx.Observer; |
22 | 21 |
|
23 | 22 | /** |
|
28 | 27 | * <p> |
29 | 28 | * An object is allocated inside {@link #error(Throwable)} to wrap the {@link Throwable} but this shouldn't |
30 | 29 | * 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 |
35 | 30 | */ |
36 | | -public final class NotificationLite<T> { |
| 31 | +public final class NotificationLite { |
37 | 32 |
|
38 | 33 | private NotificationLite() { |
39 | | - // singleton |
40 | 34 | } |
41 | 35 |
|
42 | 36 | private static final Object ON_COMPLETED_SENTINEL = new Serializable() { |
@@ -184,30 +178,6 @@ public static boolean isNull(Object n) { |
184 | 178 | public static boolean isNext(Object n) { |
185 | 179 | return n != null && !isError(n) && !isCompleted(n); |
186 | 180 | } |
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 | | - } |
211 | 181 |
|
212 | 182 | /** |
213 | 183 | * Returns the item corresponding to this {@code OnNext} lite notification. Bad things happen if you pass |
|
0 commit comments