diff --git a/rxjava-core/src/main/java/rx/Notification.java b/rxjava-core/src/main/java/rx/Notification.java index bf7ebb1881..df3e22b3a2 100644 --- a/rxjava-core/src/main/java/rx/Notification.java +++ b/rxjava-core/src/main/java/rx/Notification.java @@ -26,6 +26,8 @@ public class Notification { private final Throwable throwable; private final T value; + private static final Notification ON_COMPLETED = new Notification(Kind.OnCompleted, null, null); + public static Notification createOnNext(T t) { return new Notification(Kind.OnNext, t, null); } @@ -34,12 +36,14 @@ public static Notification createOnError(Throwable e) { return new Notification(Kind.OnError, null, e); } + @SuppressWarnings("unchecked") public static Notification createOnCompleted() { - return new Notification(Kind.OnCompleted, null, null); + return (Notification) ON_COMPLETED; } + @SuppressWarnings("unchecked") public static Notification createOnCompleted(Class type) { - return new Notification(Kind.OnCompleted, null, null); + return (Notification) ON_COMPLETED; } private Notification(Kind kind, T value, Throwable e) {