Some parallel methods in the standard libraries

  • ​ In Java 8, java.util.Arrays includes parallelSort method that implements a parallel merge sort

  • ​ In addition, java.util.Arrays provides

    • parallelPrefix for computing all the cumulative prefixes of the array w.r.t.an associative binary operator, and

    • parallelSetAll that sets the values of an array according to some function

  • ​ The scala parallel collections library also provides parallel ways for computing folds, maximum elements etc. They are quite good in general, try using them if

    • ​ the computer has many cores available,

    • ​ the applied operations are independent and thus parallelize, and

    • ​ the size of the collections is large or the applied operations take non-negligible amount of time