Skip to content

Single.zip with Iterable<T> overload does not call given zipper function #5912

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

Closed
SergejIsbrecht opened this issue Mar 13, 2018 · 6 comments
Closed

Comments

@SergejIsbrecht
Copy link
Contributor

SergejIsbrecht commented Mar 13, 2018

I have discovered that, invoking Single.zip with an empty Iterable will not call given zipper function. Is this behavior by design? I would expect that the zipper function would be called with an empty object-array.

  @Test
  void singleDoesNothing() {
    Single<Object[]> zip =
        Single.zip(
            Collections.emptyList(),
            objects -> {
              return objects;
            });

    zip.test().assertNotComplete().assertNoValues();
  }

Used version: 2.1.7

@akarnokd
Copy link
Member

Yes, this is by design.

@yuriykulikov
Copy link

Hello David,
could you please elaborate? What is the reason for this?

@akarnokd
Copy link
Member

0 sources have no items to zip.

@yuriykulikov
Copy link

It must be at least explicitely mentioned in the documentation. Otherwise there is a lot of confusion, because developers interpret the current javadoc as: "empty Iterable -> empty Array". This is very unfortunate, because an empty Iterable becomes a corner case, which does not always happen, but when it does, nothing happens.

@akarnokd
Copy link
Member

See #5876.

@artem-zinnatullin
Copy link
Contributor

Guess we could close this as #5876 was merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants