-
Enhancement
-
Resolution: Fixed
-
P3
-
None
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8206709 | 12 | Stuart Marks | P3 | Resolved | Fixed | team |
JDK-8206483 | 11.0.1 | Stuart Marks | P3 | Resolved | Fixed | b01 |
There exists a method on j.u.Stream that makes it a little easier to create an array of an appropriate type (at the expense of throwing a ArrayStoreException if the array component type is not a super type of all elements in the stream):
<A> A[] toArray(IntFunction<A[]> generator);
An equivalent method can also be added to Collection.
Given the existence of:
Collection.toArray(T[] a)
this does introduce a source code incompatibility for code passing nulls:
toArray(null);
although this is only likely to occur in tests (such as the TCK perhaps).
<A> A[] toArray(IntFunction<A[]> generator);
An equivalent method can also be added to Collection.
Given the existence of:
Collection.toArray(T[] a)
this does introduce a source code incompatibility for code passing nulls:
toArray(null);
although this is only likely to occur in tests (such as the TCK perhaps).
- backported by
-
JDK-8206483 Add default method <A> A[] Collection.toArray(IntFunction<A[]> generator)
-
- Resolved
-
-
JDK-8206709 Add default method <A> A[] Collection.toArray(IntFunction<A[]> generator)
-
- Resolved
-
- csr for
-
JDK-8193155 Add default method <A> A[] Collection.toArray(IntFunction<A[]> generator)
-
- Closed
-
- relates to
-
JDK-7023484 add typesafe static Collections.toArray(Collection<? extends T>, IntFunction<T[]>)
-
- Open
-
-
JDK-4215201 Why is toArray(Object a[]) designed this way?
-
- Closed
-
-
JDK-5072831 (coll) Please add Collections.toArray
-
- Closed
-
(1 relates to)