title: I want to call a calculation method on an arrayList of Strings. Calling this method parallely for each element would be time saving. Is there a way?
body: <pre><code>public HashMap&lt;String, BigDecimal&gt; calculateRevenueForAllMonths() {
      ArrayList&lt;String&gt; sMonths = new ArrayList&lt;String&gt;();
      //sMonths = list of 50 months
  
      HashMap&lt;String, BigDecimal&gt; monthlyRevenue = new HashMap&lt;String, BigDecimal&gt;();
      for(String m: sMonths)
        {
         monthlyVR.put(m, calculateRevenue(m));
        }
      }
  
  
  public BigDecimal calculateRevenue(String mnth) {
  
    BigDecimal businessValue = new BigDecimal(0);
  
     //perform calculations
     //store revenue generated for the given month in a big decimal
  
  
  return businessValue;
  }
  </code></pre>
  <p>I want to parallelly calculate the revenue for each month and store it back to the hashmap to save time. It takes close to 5 mins to calculate revenue for each month, hence its taking hours for the above test to complete and return the expected calculations I need. Can I use streams to achieve this in any way? Pls help</p>