forked from ReactiveX/RxJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Observable.concat: refactor varargs to overloads
ReactiveX#359 Varargs cause compiler warnings As part of this I also changed this: ```java public static <T> Observable<T> concat(Observable<Observable<? extends T>> observables) ``` to ```java public static <T> Observable<T> concat(Observable<Observable<T>> observables) ``` I documented the reasoning of this at ReactiveX#360 (comment)
- Loading branch information
1 parent
e43a781
commit 781191b
Showing
4 changed files
with
352 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package rx; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.junit.Test; | ||
|
||
public class ConcatTests { | ||
|
||
@Test | ||
public void testConcatSimple() { | ||
Observable<String> o1 = Observable.from("one", "two"); | ||
Observable<String> o2 = Observable.from("three", "four"); | ||
|
||
List<String> values = Observable.concat(o1, o2).toList().toBlockingObservable().single(); | ||
|
||
assertEquals("one", values.get(0)); | ||
assertEquals("two", values.get(1)); | ||
assertEquals("three", values.get(2)); | ||
assertEquals("four", values.get(3)); | ||
} | ||
|
||
@Test | ||
public void testConcatWithObservableOfObservable() { | ||
Observable<String> o1 = Observable.from("one", "two"); | ||
Observable<String> o2 = Observable.from("three", "four"); | ||
Observable<String> o3 = Observable.from("five", "six"); | ||
|
||
Observable<Observable<String>> os = Observable.from(o1, o2, o3); | ||
|
||
List<String> values = Observable.concat(os).toList().toBlockingObservable().single(); | ||
|
||
assertEquals("one", values.get(0)); | ||
assertEquals("two", values.get(1)); | ||
assertEquals("three", values.get(2)); | ||
assertEquals("four", values.get(3)); | ||
} | ||
|
||
@Test | ||
public void testConcatWithIterableOfObservable() { | ||
Observable<String> o1 = Observable.from("one", "two"); | ||
Observable<String> o2 = Observable.from("three", "four"); | ||
Observable<String> o3 = Observable.from("five", "six"); | ||
|
||
@SuppressWarnings("unchecked") | ||
Iterable<Observable<String>> is = Arrays.asList(o1, o2, o3); | ||
|
||
List<String> values = Observable.concat(Observable.from(is)).toList().toBlockingObservable().single(); | ||
|
||
assertEquals("one", values.get(0)); | ||
assertEquals("two", values.get(1)); | ||
assertEquals("three", values.get(2)); | ||
assertEquals("four", values.get(3)); | ||
} | ||
} |
Oops, something went wrong.