@@ -3664,6 +3664,15 @@ public final Observable<T> cache() {
36643664 return CachedObservable.from(this);
36653665 }
36663666
3667+ /**
3668+ * @see #cacheWithInitialCapacity(int)
3669+ * @deprecated Use {@link #cacheWithInitialCapacity(int)} instead.
3670+ */
3671+ @Deprecated
3672+ public final Observable<T> cache(int initialCapacity) {
3673+ return cacheWithInitialCapacity(initialCapacity);
3674+ }
3675+
36673676 /**
36683677 * Caches emissions from the source Observable and replays them in order to any subsequent Subscribers.
36693678 * This method has similar behavior to {@link #replay} except that this auto-subscribes to the source
@@ -3689,14 +3698,17 @@ public final Observable<T> cache() {
36893698 * <dt><b>Scheduler:</b></dt>
36903699 * <dd>{@code cache} does not operate by default on a particular {@link Scheduler}.</dd>
36913700 * </dl>
3701+ * <p>
3702+ * <em>Note:</em> The capacity hint is not an upper bound on cache size. For that, consider
3703+ * {@link #replay(int)} in combination with {@link ConnectableObservable#autoConnect()} or similar.
36923704 *
3693- * @param capacityHint hint for number of items to cache (for optimizing underlying data structure)
3705+ * @param initialCapacity hint for number of items to cache (for optimizing underlying data structure)
36943706 * @return an Observable that, when first subscribed to, caches all of its items and notifications for the
36953707 * benefit of subsequent subscribers
36963708 * @see <a href="http://reactivex.io/documentation/operators/replay.html">ReactiveX operators documentation: Replay</a>
36973709 */
3698- public final Observable<T> cache (int capacityHint ) {
3699- return CachedObservable.from(this, capacityHint );
3710+ public final Observable<T> cacheWithInitialCapacity (int initialCapacity ) {
3711+ return CachedObservable.from(this, initialCapacity );
37003712 }
37013713
37023714 /**
0 commit comments