/** * Creates a {@link BehaviorSubject} without a default item. * * @param <T> * the type of item the Subject will emit * @return the constructed {@link BehaviorSubject} */ @CheckReturnValue @NonNull public static <T> BehaviorSubject<T> create() { return new BehaviorSubject<T>(); }
/** * Creates a {@link BehaviorSubject} that emits the last item it observed and all subsequent items to each * {@link Observer} that subscribes to it. * * @param <T> * the type of item the Subject will emit * @param defaultValue * the item that will be emitted first to any {@link Observer} as long as the * {@link BehaviorSubject} has not yet observed any items from its source {@code Observable} * @return the constructed {@link BehaviorSubject} */ @CheckReturnValue @NonNull public static <T> BehaviorSubject<T> createDefault(T defaultValue) { return new BehaviorSubject<T>(defaultValue); }
/** * Creates a {@link BehaviorSubject} without a default item. * * @param <T> * the type of item the Subject will emit * @return the constructed {@link BehaviorSubject} */ @CheckReturnValue @NonNull public static <T> BehaviorSubject<T> create() { return new BehaviorSubject<T>(); }
/** * Creates a {@link BehaviorSubject} that emits the last item it observed and all subsequent items to each * {@link Observer} that subscribes to it. * * @param <T> * the type of item the Subject will emit * @param defaultValue * the item that will be emitted first to any {@link Observer} as long as the * {@link BehaviorSubject} has not yet observed any items from its source {@code Observable} * @return the constructed {@link BehaviorSubject} */ @CheckReturnValue @NonNull public static <T> BehaviorSubject<T> createDefault(T defaultValue) { return new BehaviorSubject<T>(defaultValue); }