mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8015667: Stream.toArray(IntFunction) ArrayStoreException should refer to component type of array
Reviewed-by: smarks
This commit is contained in:
parent
9ddcde90e0
commit
ed7a7fb89f
1 changed files with 6 additions and 5 deletions
|
@ -671,7 +671,8 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
|
|||
* <p>This is a <a href="package-summary.html#StreamOps">terminal
|
||||
* operation</a>.
|
||||
*
|
||||
* @return an array containing the elements of this stream
|
||||
* @return an array, whose {@linkplain Class#getComponentType runtime component
|
||||
* type} is {@code Object}, containing the elements of this stream
|
||||
*/
|
||||
Object[] toArray();
|
||||
|
||||
|
@ -694,13 +695,13 @@ public interface Stream<T> extends BaseStream<T, Stream<T>> {
|
|||
* .toArray(Person[]::new);
|
||||
* }</pre>
|
||||
*
|
||||
* @param <A> the element type of the resulting array
|
||||
* @param <A> the component type of the resulting array
|
||||
* @param generator a function which produces a new array of the desired
|
||||
* type and the provided length
|
||||
* @return an array containing the elements in this stream
|
||||
* @throws ArrayStoreException if the runtime type of the array returned
|
||||
* from the array generator is not a supertype of the runtime type of every
|
||||
* element in this stream
|
||||
* @throws ArrayStoreException if the runtime type of any element of this
|
||||
* stream is not assignable to the {@linkplain Class#getComponentType
|
||||
* runtime component type} of the generated array
|
||||
*/
|
||||
<A> A[] toArray(IntFunction<A[]> generator);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue