Yes Matt you’re right, I didn’t try this case in my test.
Nico Passo

Parallel processing refers to multi-threading. It’s more of an implementation detail that might improve evaluation speed of some stream expressions. Like sorting algorithms that can take advantage of multiple processor cores. I wouldn’t care if an Android implementation wouldn’t support that.

I actually checked the source code of LSA before posting the code sample. Java 8 builds up a pipeline of stream processing instructions, which it will evaluate whenever you call a terminal operation such as Stream::count(). LSA just chains some Iterators together, that’s where the ConcurrentModificationException comes from.

I fear any implementation of Java 8 Streams will be a lot more complex and that the author of LSA isn’t aware of that. I’d either switch from Java to Kotlin, or wait and stick to classic Java control flow statements for the time being. There’s a port of the original OpenJDK code called streamsupport on sourceforge, but I don’t think the license will allow us to use it in proprietary Android apps.

Like what you read? Give Matt a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.