To demonstrate the difference between sequential and parallel processing, let's imagine a system that collects data from 10 physical devices (sensors) and calculates an average. The interface of such a system could look like the following:
interface MeasuringSystem { double get(String id);}
It has only one method, get(), which receives an ID of a sensor and returns the result of the measurement. Using this interface, we can implement many different systems, which are able to call different devices. For demonstration purposes, we are not going to write a lot of code. All we need is to put a delay of 100 milliseconds (to imitate the time it takes to collect the measurement from the sensor) and return some ...