I have a JSON array containing around 10,000 JSON objects. I want to iterate the array and call a java method to process each JSON object. I want to have few threads, may be 4 to process them simultaneously.
I want to know if this is the correct way of doing it or is there any better solution
Good question.
JsonArray consists of multiple JsonObjects.
A way to simultaneously process the jsonObjects in the array, using java 8 is using IntStream, with parallStream(), like this.
Edit:
Make sure your function is threadSafe