I'm talking about http://doc.akka.io/japi/akka/current/akka/stream/javadsl/Flow.html#mapConcat-akka.japi.function.Function-
I had a flow that was emitting Iterator<T>, and I wanted a step to 'chunk' the values to a given chunk size N (in other words, every iterator returned by the 'chunker' would be no larger than the chunk size). I have Flow.<Iterator<T>>create().mapConcat(iter -> Lists.newArrayList(iter)). grouped(chunkSize).map(list -> list.iterator()) but it kind of bugs me that I need to create an intermediate list (seems like an unnecessary copy). I know this probably won't affect performance perceptibly in most cases, but I wonder why Iterable was used? Are multiple iterators ever needed to be requested from it? I'm kind of tempted to do Flow.<Iterator<T>>create().mapConcat(iter -> new Iterable<T>() { @Override public Iterator<T> iterator() { return iter; }}).grouped(chunkSize).map(list -> list.iterator()) -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.