@@ -3664,6 +3664,15 @@ public final Observable<T> cache() {
3664
3664
return CachedObservable.from(this);
3665
3665
}
3666
3666
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
+
3667
3676
/**
3668
3677
* Caches emissions from the source Observable and replays them in order to any subsequent Subscribers.
3669
3678
* 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() {
3689
3698
* <dt><b>Scheduler:</b></dt>
3690
3699
* <dd>{@code cache} does not operate by default on a particular {@link Scheduler}.</dd>
3691
3700
* </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.
3692
3704
*
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)
3694
3706
* @return an Observable that, when first subscribed to, caches all of its items and notifications for the
3695
3707
* benefit of subsequent subscribers
3696
3708
* @see <a href="http://reactivex.io/documentation/operators/replay.html">ReactiveX operators documentation: Replay</a>
3697
3709
*/
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 );
3700
3712
}
3701
3713
3702
3714
/**
0 commit comments