mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8074043: java.util.Arrays setAll and parallelSetAll subrange note
Reviewed-by: smarks
This commit is contained in:
parent
9b8b669510
commit
43f188234a
1 changed files with 68 additions and 0 deletions
|
@ -4685,6 +4685,14 @@ public class Arrays {
|
|||
* <p>If the generator function throws an exception, it is relayed to
|
||||
* the caller and the array is left in an indeterminate state.
|
||||
*
|
||||
* @apiNote
|
||||
* Setting a subrange of an array, using a generator function to compute
|
||||
* each element, can be written as follows:
|
||||
* <pre>{@code
|
||||
* IntStream.range(startInclusive, endExclusive)
|
||||
* .forEach(i -> array[i] = generator.apply(i));
|
||||
* }</pre>
|
||||
*
|
||||
* @param <T> type of elements of the array
|
||||
* @param array array to be initialized
|
||||
* @param generator a function accepting an index and producing the desired
|
||||
|
@ -4706,6 +4714,15 @@ public class Arrays {
|
|||
* is thrown from {@code parallelSetAll} and the array is left in an
|
||||
* indeterminate state.
|
||||
*
|
||||
* @apiNote
|
||||
* Setting a subrange of an array, in parallel, using a generator function
|
||||
* to compute each element, can be written as follows:
|
||||
* <pre>{@code
|
||||
* IntStream.range(startInclusive, endExclusive)
|
||||
* .parallel()
|
||||
* .forEach(i -> array[i] = generator.apply(i));
|
||||
* }</pre>
|
||||
*
|
||||
* @param <T> type of elements of the array
|
||||
* @param array array to be initialized
|
||||
* @param generator a function accepting an index and producing the desired
|
||||
|
@ -4725,6 +4742,14 @@ public class Arrays {
|
|||
* <p>If the generator function throws an exception, it is relayed to
|
||||
* the caller and the array is left in an indeterminate state.
|
||||
*
|
||||
* @apiNote
|
||||
* Setting a subrange of an array, using a generator function to compute
|
||||
* each element, can be written as follows:
|
||||
* <pre>{@code
|
||||
* IntStream.range(startInclusive, endExclusive)
|
||||
* .forEach(i -> array[i] = generator.applyAsInt(i));
|
||||
* }</pre>
|
||||
*
|
||||
* @param array array to be initialized
|
||||
* @param generator a function accepting an index and producing the desired
|
||||
* value for that position
|
||||
|
@ -4745,6 +4770,15 @@ public class Arrays {
|
|||
* is thrown from {@code parallelSetAll} and the array is left in an
|
||||
* indeterminate state.
|
||||
*
|
||||
* @apiNote
|
||||
* Setting a subrange of an array, in parallel, using a generator function
|
||||
* to compute each element, can be written as follows:
|
||||
* <pre>{@code
|
||||
* IntStream.range(startInclusive, endExclusive)
|
||||
* .parallel()
|
||||
* .forEach(i -> array[i] = generator.applyAsInt(i));
|
||||
* }</pre>
|
||||
*
|
||||
* @param array array to be initialized
|
||||
* @param generator a function accepting an index and producing the desired
|
||||
* value for that position
|
||||
|
@ -4763,6 +4797,14 @@ public class Arrays {
|
|||
* <p>If the generator function throws an exception, it is relayed to
|
||||
* the caller and the array is left in an indeterminate state.
|
||||
*
|
||||
* @apiNote
|
||||
* Setting a subrange of an array, using a generator function to compute
|
||||
* each element, can be written as follows:
|
||||
* <pre>{@code
|
||||
* IntStream.range(startInclusive, endExclusive)
|
||||
* .forEach(i -> array[i] = generator.applyAsLong(i));
|
||||
* }</pre>
|
||||
*
|
||||
* @param array array to be initialized
|
||||
* @param generator a function accepting an index and producing the desired
|
||||
* value for that position
|
||||
|
@ -4783,6 +4825,15 @@ public class Arrays {
|
|||
* is thrown from {@code parallelSetAll} and the array is left in an
|
||||
* indeterminate state.
|
||||
*
|
||||
* @apiNote
|
||||
* Setting a subrange of an array, in parallel, using a generator function
|
||||
* to compute each element, can be written as follows:
|
||||
* <pre>{@code
|
||||
* IntStream.range(startInclusive, endExclusive)
|
||||
* .parallel()
|
||||
* .forEach(i -> array[i] = generator.applyAsLong(i));
|
||||
* }</pre>
|
||||
*
|
||||
* @param array array to be initialized
|
||||
* @param generator a function accepting an index and producing the desired
|
||||
* value for that position
|
||||
|
@ -4801,6 +4852,14 @@ public class Arrays {
|
|||
* <p>If the generator function throws an exception, it is relayed to
|
||||
* the caller and the array is left in an indeterminate state.
|
||||
*
|
||||
* @apiNote
|
||||
* Setting a subrange of an array, using a generator function to compute
|
||||
* each element, can be written as follows:
|
||||
* <pre>{@code
|
||||
* IntStream.range(startInclusive, endExclusive)
|
||||
* .forEach(i -> array[i] = generator.applyAsDouble(i));
|
||||
* }</pre>
|
||||
*
|
||||
* @param array array to be initialized
|
||||
* @param generator a function accepting an index and producing the desired
|
||||
* value for that position
|
||||
|
@ -4821,6 +4880,15 @@ public class Arrays {
|
|||
* is thrown from {@code parallelSetAll} and the array is left in an
|
||||
* indeterminate state.
|
||||
*
|
||||
* @apiNote
|
||||
* Setting a subrange of an array, in parallel, using a generator function
|
||||
* to compute each element, can be written as follows:
|
||||
* <pre>{@code
|
||||
* IntStream.range(startInclusive, endExclusive)
|
||||
* .parallel()
|
||||
* .forEach(i -> array[i] = generator.applyAsDouble(i));
|
||||
* }</pre>
|
||||
*
|
||||
* @param array array to be initialized
|
||||
* @param generator a function accepting an index and producing the desired
|
||||
* value for that position
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue