Multiple threads for forEach loop in Spark

I have Spark Java App, where I need to iterate over a uniqueProductGroups list, and filter rdd based on value from this list. (see code below)

After that, for filtered rdd, I need to perform some calculations and output results into output file.

So basically, this loop doing the same ~100 times.

The method calculate() takes a lot of time. So I am wondering if there is a way to create multiple threads for forEach loop AND run this loop in parallel?

JavaRDD<DataObject> webLabRddAllRecords  = // get javaRdd from text file;
List<String> uniqueProductGroups = // get list of strings

uniqueProductGroups.forEach(prGroup -> {
  JavaRDD<DataObject> filteredByProductGroupCollection = webLabRddAllRecords
      .filter(data ->{
        return uniqueProductGroups.contains(data.getProductGroup());
      });
      calculate(filteredByProductGroupCollection); //This method will calculate some data for each filtered javaRdd and save result in the output file;
});





private void calculate(JavaRDD<WebLabPurchasesDataObject> webLabDataCollection)
{
double a = calculateTotalOps(webLabDataCollection);
double b = calculateTotalUnits(webLabDataCollection);
double c = calculateMeanConditionalOPS(webLabDataCollection);
double d = calculateMeanConditionalPrice(webLabDataCollection);

saveToFileS3file(a,b,c,d);

}

private double calculateTotalOps(JavaRDD<WebLabPurchasesDataObject> webLabDataCollection)
{
    return webLabDataCollection
        .mapToDouble(data -> data.getPrice() * data.getQuantity())
        .sum();
}

private double calculateTotalUnits(JavaRDD<WebLabPurchasesDataObject> webLabDataCollection)
{
    return webLabDataCollection
        .mapToDouble(data ->  data.getQuantity())
        .sum();
}


private double calculateMeanConditionalOPS(JavaRDD<WebLabPurchasesDataObject> webLabDataCollection)
{
    return webLabDataCollection
        .mapToDouble(data -> data.getPrice() * data.getQuantity())
        .mean();
}


private double calculateMeanConditionalPrice(JavaRDD<WebLabPurchasesDataObject> webLabDataCollection) 
{
    return webLabDataCollection
        .mapToDouble(data -> data.getPrice())
        .mean();
}