> On 5 Dec 2017, at 11:19, Stuart Marks <stuart.ma...@oracle.com> wrote: > > > > On 12/5/17 10:47 AM, Paul Sandoz wrote: >> 345 * <p>Suppose {@code x} is a collection known to contain only >> strings. >> 346 * The following code can be used to dump the collection into a >> newly >> 347 * allocated array of {@code String}: >> Make it an API note? (same for toArray(T[]) > > Will do. > >> 352 * @implSpec >> 353 * The default implementation calls the generator function with zero >> 354 * and then passes the resulting array to {@link #toArray(T[])}. >> That’s reasonable. I pondered about being vague and specifying a value in >> the range if [0, size()), to allow wiggle room for using 0 or size(). > > No, I really think it has to be exactly zero. If the default were to choose > some value K < size(), the collection size could change to be smaller than K > after allocation but before the call to toArray(T[]), resulting in an array > that is unexpectedly large.
Ah yes, concurrent collections. Paul. > >> 360 * @throws ArrayStoreException if the runtime type of any element >> in this >> 361 * collection is not assignable to the {@linkplain >> Class#getComponentType >> 362 * runtime component type} of array returned by the >> generator function >> s/of array returned by the generator function/of the generated array/ ? > > Will do. > > s'marks