M
M
mitaichik2017-03-27 00:56:45
Java
mitaichik, 2017-03-27 00:56:45

How to make a stream (java.util.stream) from an unformed source?

Hello! I'm new to java, don't judge me too hard.
I read about java.util.stream. I liked the approach, I began to use it everywhere, but only on the basis of ready-made collections.
Here the task arose: There is a certain API, I need to pull off 200,000 records from it and process it in java.util.stream style. I access the api in 50 threads, each of which makes 4,000 requests. After receiving one record, it needs to be processed (waiting until all 200,000 records are downloaded is not optimal and costly).
It turns out that you need to make some kind of asynchronous iterator / collection from which to create a thread? Or somehow differently? What is the best way to do this in streaming style?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question