Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.x: Rename combineLatest methods that take an array to combineLatestArray #6640

Merged
merged 1 commit into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/main/java/io/reactivex/rxjava3/core/Flowable.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public static int bufferSize() {
* are requested in a bounded manner, however, their backpressure is not enforced (the operator won't signal
* {@code MissingBackpressureException}) and may lead to {@code OutOfMemoryError} due to internal buffer bloat.</dd>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
* <dd>{@code combineLatestArray} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @param <T>
Expand All @@ -273,8 +273,8 @@ public static int bufferSize() {
@SchedulerSupport(SchedulerSupport.NONE)
@CheckReturnValue
@BackpressureSupport(BackpressureKind.FULL)
public static <T, R> Flowable<R> combineLatest(Publisher<? extends T>[] sources, Function<? super Object[], ? extends R> combiner) {
return combineLatest(sources, combiner, bufferSize());
public static <T, R> Flowable<R> combineLatestArray(Publisher<? extends T>[] sources, Function<? super Object[], ? extends R> combiner) {
return combineLatestArray(sources, combiner, bufferSize());
}

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

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

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

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

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

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

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

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

/**
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/io/reactivex/rxjava3/core/Observable.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSo
* <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/combineLatest.png" alt="">
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
* <dd>{@code combineLatestArray} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @param <T>
Expand All @@ -298,9 +298,9 @@ public static <T, R> Observable<R> combineLatest(Iterable<? extends ObservableSo
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[] sources,
public static <T, R> Observable<R> combineLatestArray(ObservableSource<? extends T>[] sources,
Function<? super Object[], ? extends R> combiner) {
return combineLatest(sources, combiner, bufferSize());
return combineLatestArray(sources, combiner, bufferSize());
}

/**
Expand All @@ -323,7 +323,7 @@ public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[]
* <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/combineLatest.png" alt="">
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code combineLatest} does not operate by default on a particular {@link Scheduler}.</dd>
* <dd>{@code combineLatestArray} does not operate by default on a particular {@link Scheduler}.</dd>
* </dl>
*
* @param <T>
Expand All @@ -343,7 +343,7 @@ public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[]
@CheckReturnValue
@NonNull
@SchedulerSupport(SchedulerSupport.NONE)
public static <T, R> Observable<R> combineLatest(ObservableSource<? extends T>[] sources,
public static <T, R> Observable<R> combineLatestArray(ObservableSource<? extends T>[] sources,
Function<? super Object[], ? extends R> combiner, int bufferSize) {
ObjectHelper.requireNonNull(sources, "sources is null");
if (sources.length == 0) {
Expand Down Expand Up @@ -394,7 +394,7 @@ public static <T1, T2, R> Observable<R> combineLatest(
BiFunction<? super T1, ? super T2, ? extends R> combiner) {
ObjectHelper.requireNonNull(source1, "source1 is null");
ObjectHelper.requireNonNull(source2, "source2 is null");
return combineLatest(new ObservableSource[] { source1, source2 }, Functions.toFunction(combiner), bufferSize());
return combineLatestArray(new ObservableSource[] { source1, source2 }, Functions.toFunction(combiner), bufferSize());
}

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

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

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

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

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

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

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ public void combineLatestNArguments() throws Exception {

@SuppressWarnings("unchecked")
@Test
public void combineLatestNSources() {
public void combineLatestArrayNSources() {
for (int i = 1; i < 100; i++) {
Flowable<Integer>[] sources = new Flowable[i];
Arrays.fill(sources, Flowable.just(1));
Expand All @@ -1071,7 +1071,7 @@ public void combineLatestNSources() {
expected.add(1);
}

Flowable.combineLatest(sources, new Function<Object[], List<Object>>() {
Flowable.combineLatestArray(sources, new Function<Object[], List<Object>>() {
@Override
public List<Object> apply(Object[] t) throws Exception {
return Arrays.asList(t);
Expand All @@ -1095,7 +1095,7 @@ public List<Object> apply(Object[] t) throws Exception {
@Test
public void combineLatestArrayOfSources() {

Flowable.combineLatest(new Flowable[] {
Flowable.combineLatestArray(new Flowable[] {
Flowable.just(1), Flowable.just(2)
}, new Function<Object[], Object>() {
@Override
Expand Down Expand Up @@ -1173,8 +1173,8 @@ public Object apply(Object[] a) throws Exception {

@SuppressWarnings("unchecked")
@Test
public void combineLatestEmpty() {
assertSame(Flowable.empty(), Flowable.combineLatest(new Flowable[0], Functions.<Object[]>identity(), 16));
public void combineLatestArrayEmpty() {
assertSame(Flowable.empty(), Flowable.combineLatestArray(new Flowable[0], Functions.<Object[]>identity(), 16));
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ public Long apply(Long t1, Integer t2) {
@Test
public void combineLatestArrayOfSources() {

Observable.combineLatest(new ObservableSource[] {
Observable.combineLatestArray(new ObservableSource[] {
Observable.just(1), Observable.just(2)
}, new Function<Object[], Object>() {
@Override
Expand Down Expand Up @@ -851,8 +851,8 @@ public Object apply(Object[] a) throws Exception {

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

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class CombineLatestArrayTckTest extends BaseTck<Long> {
@Override
public Publisher<Long> createPublisher(long elements) {
return
Flowable.combineLatest(
Flowable.combineLatestArray(
new Publisher[] { Flowable.just(1L), Flowable.fromIterable(iterate(elements)) },
new Function<Object[], Long>() {
@Override
Expand Down