Skip to content

Commit 044cd53

Browse files
committed
Merge pull request #1469 from mattrjacobs/fix-tolist-backpressure
ToList operator needs to ignore backpressure
2 parents 5c0f4eb + d81cbcd commit 044cd53

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

rxjava-core/src/main/java/rx/internal/operators/OperatorToObservableList.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public Subscriber<? super T> call(final Subscriber<? super List<T>> o) {
4444

4545
final List<T> list = new LinkedList<T>();
4646

47+
@Override
48+
public void onStart() {
49+
request(Long.MAX_VALUE);
50+
}
51+
4752
@Override
4853
public void onCompleted() {
4954
try {

rxjava-core/src/test/java/rx/internal/operators/OperatorToObservableListTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.Arrays;
2424
import java.util.List;
2525

26+
import org.junit.Assert;
2627
import org.junit.Test;
2728
import org.mockito.Mockito;
2829

@@ -94,4 +95,11 @@ public void testListWithNullValue() {
9495
verify(observer, Mockito.never()).onError(any(Throwable.class));
9596
verify(observer, times(1)).onCompleted();
9697
}
98+
99+
@Test
100+
public void testListWithBlockingFirst() {
101+
Observable<String> o = Observable.from(Arrays.asList("one", "two", "three"));
102+
List<String> actual = o.toList().toBlocking().first();
103+
Assert.assertEquals(Arrays.asList("one", "two", "three"), actual);
104+
}
97105
}

0 commit comments

Comments
 (0)