Skip to content

Commit c9204b5

Browse files
vanniktechakarnokd
authored andcommitted
3.x: Rename combineLatest methods that take an array to combineLatestArray (#6640)
1 parent a07c45e commit c9204b5

File tree

5 files changed

+35
-35
lines changed

5 files changed

+35
-35
lines changed

src/main/java/io/reactivex/rxjava3/core/Flowable.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ public static int bufferSize() {
255255
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
256256
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.</dd>
257257
* <dt><b>Scheduler:</b></dt>
258-
* <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
258+
* <dd>{@code combineLatestArray} does not operate by default on a particular {@link Scheduler}.</dd>
259259
* </dl>
260260
*
261261
* @param <T>
@@ -273,8 +273,8 @@ public static int bufferSize() {
273273
@SchedulerSupport(SchedulerSupport.NONE)
274274
@CheckReturnValue
275275
@BackpressureSupport(BackpressureKind.FULL)
276-
public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources, Function<? super Object[], ? extends R> combiner) {
277-
return combineLatest(sources, combiner, bufferSize());
276+
public static <T, R> Flowable<R> combineLatestArray(Publisher<? extends T>[] sources, Function<? super Object[], ? extends R> combiner) {
277+
return combineLatestArray(sources, combiner, bufferSize());
278278
}
279279

280280
/**
@@ -299,7 +299,7 @@ public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources,
299299
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
300300
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.</dd>
301301
* <dt><b>Scheduler:</b></dt>
302-
* <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
302+
* <dd>{@code combineLatestArray} does not operate by default on a particular {@link Scheduler}.</dd>
303303
* </dl>
304304
*
305305
* @param <T>
@@ -320,7 +320,7 @@ public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources,
320320
@CheckReturnValue
321321
@NonNull
322322
@BackpressureSupport(BackpressureKind.FULL)
323-
public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources, Function<? super Object[], ? extends R> combiner, int bufferSize) {
323+
public static <T, R> Flowable<R> combineLatestArray(Publisher<? extends T>[] sources, Function<? super Object[], ? extends R> combiner, int bufferSize) {
324324
ObjectHelper.requireNonNull(sources, "sources is null");
325325
if (sources.length == 0) {
326326
return empty();
@@ -664,7 +664,7 @@ public static <T1, T2, R> Flowable<R> combineLatest(
664664
BiFunction<? super T1, ? super T2, ? extends R> combiner) {
665665
ObjectHelper.requireNonNull(source1, "source1 is null");
666666
ObjectHelper.requireNonNull(source2, "source2 is null");
667-
return combineLatest(new Publisher[] { source1, source2 }, Functions.toFunction(combiner), bufferSize());
667+
return combineLatestArray(new Publisher[] { source1, source2 }, Functions.toFunction(combiner), bufferSize());
668668
}
669669

670670
/**
@@ -714,7 +714,7 @@ public static <T1, T2, T3, R> Flowable<R> combineLatest(
714714
ObjectHelper.requireNonNull(source1, "source1 is null");
715715
ObjectHelper.requireNonNull(source2, "source2 is null");
716716
ObjectHelper.requireNonNull(source3, "source3 is null");
717-
return combineLatest(new Publisher[] { source1, source2, source3 }, Functions.toFunction(combiner), bufferSize());
717+
return combineLatestArray(new Publisher[] { source1, source2, source3 }, Functions.toFunction(combiner), bufferSize());
718718
}
719719

720720
/**
@@ -768,7 +768,7 @@ public static <T1, T2, T3, T4, R> Flowable<R> combineLatest(
768768
ObjectHelper.requireNonNull(source2, "source2 is null");
769769
ObjectHelper.requireNonNull(source3, "source3 is null");
770770
ObjectHelper.requireNonNull(source4, "source4 is null");
771-
return combineLatest(new Publisher[] { source1, source2, source3, source4 }, Functions.toFunction(combiner), bufferSize());
771+
return combineLatestArray(new Publisher[] { source1, source2, source3, source4 }, Functions.toFunction(combiner), bufferSize());
772772
}
773773

774774
/**
@@ -827,7 +827,7 @@ public static <T1, T2, T3, T4, T5, R> Flowable<R> combineLatest(
827827
ObjectHelper.requireNonNull(source3, "source3 is null");
828828
ObjectHelper.requireNonNull(source4, "source4 is null");
829829
ObjectHelper.requireNonNull(source5, "source5 is null");
830-
return combineLatest(new Publisher[] { source1, source2, source3, source4, source5 }, Functions.toFunction(combiner), bufferSize());
830+
return combineLatestArray(new Publisher[] { source1, source2, source3, source4, source5 }, Functions.toFunction(combiner), bufferSize());
831831
}
832832

833833
/**
@@ -890,7 +890,7 @@ public static <T1, T2, T3, T4, T5, T6, R> Flowable<R> combineLatest(
890890
ObjectHelper.requireNonNull(source4, "source4 is null");
891891
ObjectHelper.requireNonNull(source5, "source5 is null");
892892
ObjectHelper.requireNonNull(source6, "source6 is null");
893-
return combineLatest(new Publisher[] { source1, source2, source3, source4, source5, source6 }, Functions.toFunction(combiner), bufferSize());
893+
return combineLatestArray(new Publisher[] { source1, source2, source3, source4, source5, source6 }, Functions.toFunction(combiner), bufferSize());
894894
}
895895

896896
/**
@@ -958,7 +958,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, R> Flowable<R> combineLatest(
958958
ObjectHelper.requireNonNull(source5, "source5 is null");
959959
ObjectHelper.requireNonNull(source6, "source6 is null");
960960
ObjectHelper.requireNonNull(source7, "source7 is null");
961-
return combineLatest(new Publisher[] { source1, source2, source3, source4, source5, source6, source7 }, Functions.toFunction(combiner), bufferSize());
961+
return combineLatestArray(new Publisher[] { source1, source2, source3, source4, source5, source6, source7 }, Functions.toFunction(combiner), bufferSize());
962962
}
963963

964964
/**
@@ -1030,7 +1030,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Flowable<R> combineLatest(
10301030
ObjectHelper.requireNonNull(source6, "source6 is null");
10311031
ObjectHelper.requireNonNull(source7, "source7 is null");
10321032
ObjectHelper.requireNonNull(source8, "source8 is null");
1033-
return combineLatest(new Publisher[] { source1, source2, source3, source4, source5, source6, source7, source8 }, Functions.toFunction(combiner), bufferSize());
1033+
return combineLatestArray(new Publisher[] { source1, source2, source3, source4, source5, source6, source7, source8 }, Functions.toFunction(combiner), bufferSize());
10341034
}
10351035

10361036
/**
@@ -1107,7 +1107,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Flowable<R> combineLatest(
11071107
ObjectHelper.requireNonNull(source7, "source7 is null");
11081108
ObjectHelper.requireNonNull(source8, "source8 is null");
11091109
ObjectHelper.requireNonNull(source9, "source9 is null");
1110-
return combineLatest(new Publisher[] { source1, source2, source3, source4, source5, source6, source7, source8, source9 }, Functions.toFunction(combiner), bufferSize());
1110+
return combineLatestArray(new Publisher[] { source1, source2, source3, source4, source5, source6, source7, source8, source9 }, Functions.toFunction(combiner), bufferSize());
11111111
}
11121112

11131113
/**

src/main/java/io/reactivex/rxjava3/core/Observable.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSo
281281
* <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/combineLatest.png" alt="">
282282
* <dl>
283283
* <dt><b>Scheduler:</b></dt>
284-
* <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
284+
* <dd>{@code combineLatestArray} does not operate by default on a particular {@link Scheduler}.</dd>
285285
* </dl>
286286
*
287287
* @param <T>
@@ -298,9 +298,9 @@ public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSo
298298
*/
299299
@CheckReturnValue
300300
@SchedulerSupport(SchedulerSupport.NONE)
301-
public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[] sources,
301+
public static <T, R> Observable<R> combineLatestArray(ObservableSource<? extends T>[] sources,
302302
Function<? super Object[], ? extends R> combiner) {
303-
return combineLatest(sources, combiner, bufferSize());
303+
return combineLatestArray(sources, combiner, bufferSize());
304304
}
305305

306306
/**
@@ -323,7 +323,7 @@ public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[]
323323
* <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/combineLatest.png" alt="">
324324
* <dl>
325325
* <dt><b>Scheduler:</b></dt>
326-
* <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
326+
* <dd>{@code combineLatestArray} does not operate by default on a particular {@link Scheduler}.</dd>
327327
* </dl>
328328
*
329329
* @param <T>
@@ -343,7 +343,7 @@ public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[]
343343
@CheckReturnValue
344344
@NonNull
345345
@SchedulerSupport(SchedulerSupport.NONE)
346-
public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[] sources,
346+
public static <T, R> Observable<R> combineLatestArray(ObservableSource<? extends T>[] sources,
347347
Function<? super Object[], ? extends R> combiner, int bufferSize) {
348348
ObjectHelper.requireNonNull(sources, "sources is null");
349349
if (sources.length == 0) {
@@ -394,7 +394,7 @@ public static <T1, T2, R> Observable<R> combineLatest(
394394
BiFunction<? super T1, ? super T2, ? extends R> combiner) {
395395
ObjectHelper.requireNonNull(source1, "source1 is null");
396396
ObjectHelper.requireNonNull(source2, "source2 is null");
397-
return combineLatest(new ObservableSource[] { source1, source2 }, Functions.toFunction(combiner), bufferSize());
397+
return combineLatestArray(new ObservableSource[] { source1, source2 }, Functions.toFunction(combiner), bufferSize());
398398
}
399399

400400
/**
@@ -439,7 +439,7 @@ public static <T1, T2, T3, R> Observable<R> combineLatest(
439439
ObjectHelper.requireNonNull(source1, "source1 is null");
440440
ObjectHelper.requireNonNull(source2, "source2 is null");
441441
ObjectHelper.requireNonNull(source3, "source3 is null");
442-
return combineLatest(new ObservableSource[] { source1, source2, source3 }, Functions.toFunction(combiner), bufferSize());
442+
return combineLatestArray(new ObservableSource[] { source1, source2, source3 }, Functions.toFunction(combiner), bufferSize());
443443
}
444444

445445
/**
@@ -488,7 +488,7 @@ public static <T1, T2, T3, T4, R> Observable<R> combineLatest(
488488
ObjectHelper.requireNonNull(source2, "source2 is null");
489489
ObjectHelper.requireNonNull(source3, "source3 is null");
490490
ObjectHelper.requireNonNull(source4, "source4 is null");
491-
return combineLatest(new ObservableSource[] { source1, source2, source3, source4 }, Functions.toFunction(combiner), bufferSize());
491+
return combineLatestArray(new ObservableSource[] { source1, source2, source3, source4 }, Functions.toFunction(combiner), bufferSize());
492492
}
493493

494494
/**
@@ -542,7 +542,7 @@ public static <T1, T2, T3, T4, T5, R> Observable<R> combineLatest(
542542
ObjectHelper.requireNonNull(source3, "source3 is null");
543543
ObjectHelper.requireNonNull(source4, "source4 is null");
544544
ObjectHelper.requireNonNull(source5, "source5 is null");
545-
return combineLatest(new ObservableSource[] { source1, source2, source3, source4, source5 }, Functions.toFunction(combiner), bufferSize());
545+
return combineLatestArray(new ObservableSource[] { source1, source2, source3, source4, source5 }, Functions.toFunction(combiner), bufferSize());
546546
}
547547

548548
/**
@@ -600,7 +600,7 @@ public static <T1, T2, T3, T4, T5, T6, R> Observable<R> combineLatest(
600600
ObjectHelper.requireNonNull(source4, "source4 is null");
601601
ObjectHelper.requireNonNull(source5, "source5 is null");
602602
ObjectHelper.requireNonNull(source6, "source6 is null");
603-
return combineLatest(new ObservableSource[] { source1, source2, source3, source4, source5, source6 }, Functions.toFunction(combiner), bufferSize());
603+
return combineLatestArray(new ObservableSource[] { source1, source2, source3, source4, source5, source6 }, Functions.toFunction(combiner), bufferSize());
604604
}
605605

606606
/**
@@ -663,7 +663,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, R> Observable<R> combineLatest(
663663
ObjectHelper.requireNonNull(source5, "source5 is null");
664664
ObjectHelper.requireNonNull(source6, "source6 is null");
665665
ObjectHelper.requireNonNull(source7, "source7 is null");
666-
return combineLatest(new ObservableSource[] { source1, source2, source3, source4, source5, source6, source7 }, Functions.toFunction(combiner), bufferSize());
666+
return combineLatestArray(new ObservableSource[] { source1, source2, source3, source4, source5, source6, source7 }, Functions.toFunction(combiner), bufferSize());
667667
}
668668

669669
/**
@@ -730,7 +730,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Observable<R> combineLatest(
730730
ObjectHelper.requireNonNull(source6, "source6 is null");
731731
ObjectHelper.requireNonNull(source7, "source7 is null");
732732
ObjectHelper.requireNonNull(source8, "source8 is null");
733-
return combineLatest(new ObservableSource[] { source1, source2, source3, source4, source5, source6, source7, source8 }, Functions.toFunction(combiner), bufferSize());
733+
return combineLatestArray(new ObservableSource[] { source1, source2, source3, source4, source5, source6, source7, source8 }, Functions.toFunction(combiner), bufferSize());
734734
}
735735

736736
/**
@@ -802,7 +802,7 @@ public static <T1, T2, T3, T4, T5, T6, T7, T8, T9, R> Observable<R> combineLates
802802
ObjectHelper.requireNonNull(source7, "source7 is null");
803803
ObjectHelper.requireNonNull(source8, "source8 is null");
804804
ObjectHelper.requireNonNull(source9, "source9 is null");
805-
return combineLatest(new ObservableSource[] { source1, source2, source3, source4, source5, source6, source7, source8, source9 }, Functions.toFunction(combiner), bufferSize());
805+
return combineLatestArray(new ObservableSource[] { source1, source2, source3, source4, source5, source6, source7, source8, source9 }, Functions.toFunction(combiner), bufferSize());
806806
}
807807

808808
/**

src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableCombineLatestTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ public void combineLatestNArguments() throws Exception {
10621062

10631063
@SuppressWarnings("unchecked")
10641064
@Test
1065-
public void combineLatestNSources() {
1065+
public void combineLatestArrayNSources() {
10661066
for (int i = 1; i < 100; i++) {
10671067
Flowable<Integer>[] sources = new Flowable[i];
10681068
Arrays.fill(sources, Flowable.just(1));
@@ -1071,7 +1071,7 @@ public void combineLatestNSources() {
10711071
expected.add(1);
10721072
}
10731073

1074-
Flowable.combineLatest(sources, new Function<Object[], List<Object>>() {
1074+
Flowable.combineLatestArray(sources, new Function<Object[], List<Object>>() {
10751075
@Override
10761076
public List<Object> apply(Object[] t) throws Exception {
10771077
return Arrays.asList(t);
@@ -1095,7 +1095,7 @@ public List<Object> apply(Object[] t) throws Exception {
10951095
@Test
10961096
public void combineLatestArrayOfSources() {
10971097

1098-
Flowable.combineLatest(new Flowable[] {
1098+
Flowable.combineLatestArray(new Flowable[] {
10991099
Flowable.just(1), Flowable.just(2)
11001100
}, new Function<Object[], Object>() {
11011101
@Override
@@ -1173,8 +1173,8 @@ public Object apply(Object[] a) throws Exception {
11731173

11741174
@SuppressWarnings("unchecked")
11751175
@Test
1176-
public void combineLatestEmpty() {
1177-
assertSame(Flowable.empty(), Flowable.combineLatest(new Flowable[0], Functions.<Object[]>identity(), 16));
1176+
public void combineLatestArrayEmpty() {
1177+
assertSame(Flowable.empty(), Flowable.combineLatestArray(new Flowable[0], Functions.<Object[]>identity(), 16));
11781178
}
11791179

11801180
@SuppressWarnings("unchecked")

src/test/java/io/reactivex/rxjava3/internal/operators/observable/ObservableCombineLatestTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ public Long apply(Long t1, Integer t2) {
773773
@Test
774774
public void combineLatestArrayOfSources() {
775775

776-
Observable.combineLatest(new ObservableSource[] {
776+
Observable.combineLatestArray(new ObservableSource[] {
777777
Observable.just(1), Observable.just(2)
778778
}, new Function<Object[], Object>() {
779779
@Override
@@ -851,8 +851,8 @@ public Object apply(Object[] a) throws Exception {
851851

852852
@SuppressWarnings("unchecked")
853853
@Test
854-
public void combineLatestEmpty() {
855-
assertSame(Observable.empty(), Observable.combineLatest(new ObservableSource[0], Functions.<Object[]>identity(), 16));
854+
public void combineLatestArrayEmpty() {
855+
assertSame(Observable.empty(), Observable.combineLatestArray(new ObservableSource[0], Functions.<Object[]>identity(), 16));
856856
}
857857

858858
@SuppressWarnings("unchecked")

src/test/java/io/reactivex/rxjava3/tck/CombineLatestArrayTckTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class CombineLatestArrayTckTest extends BaseTck<Long> {
2626
@Override
2727
public Publisher<Long> createPublisher(long elements) {
2828
return
29-
Flowable.combineLatest(
29+
Flowable.combineLatestArray(
3030
new Publisher[] { Flowable.just(1L), Flowable.fromIterable(iterate(elements)) },
3131
new Function<Object[], Long>() {
3232
@Override

0 commit comments

Comments
 (0)