Other Parallel Array Operations
In addition to method parallelSort
, class Arrays
now contains methods parallelSetAll
and parallelPrefix
, which perform the following tasks:
• parallelSetAll—Fills an array with values produced by a generator function that receives an int
and returns a value of type int
, long
or double
. Depending on which overload of method parallelSetAll
is used, the generator function is an object of a class that implements IntToDoubleFunction
(for double
arrays), IntUnaryOperator
(for int
arrays), IntToLongFunction
(for long
arrays) or IntFunction
(for arrays of any non-primitive type).
• parallelPrefix—Applies a BinaryOperator
to the current and previous array elements and stores the result in the current element. For example, ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.