Spliterator#tryAdvance

Paul Sandoz paul.sandoz at oracle.com
Fri Mar 29 07:55:21 PDT 2013


Hi Boaz,

Spliterator. tryAdvance will return false if, upon invocation, there are no remaining elements  Once tryAdvance returns false it must always return false.

On Mar 29, 2013, at 3:36 PM, Boaz Nahum <boaznahum at gmail.com> wrote:

> Silly me, I forgot the main point.
> In my implementation of tryAdvanc() I found my self need to delegate to
> other  Spliterator.
> And there comes the question if I can call it again after once it returns
> false ? Or I need to remember it ?
> 

No need to remember it, you can do:

  boolean tryAdvance(Consumer c) {
      return delegate.tryAdvance(c);
  }

Paul.


More information about the lambda-dev mailing list