I would like to start to parallelize my Java code. This is my toy-problem. I have two vectors (double []) containing respectively the height and the base of several triangles. I have a class, Triangle, containing a method, computeArea, that computes the area of a triangle (height*base/2). For each triangle I have I want to store the area in a third vector (double []). Currently I have a for loop like this
for(int i=0; i<height.length; i++){
area[i] = triangle.computeArea(height[i], base[i]);
}
Some suggestion on how to parallelize the code? Could you kindly provide me a simple example? I am using jdk 1.8. Please note that the values in the vector area must correspond to values in vectors height and base.
Thanks in advance