On Mon, Dec 11, 2017 at 8:00 PM, John Rose <john.r.r...@oracle.com> wrote:
> I submit to you that such a factory is *not* an IntFunction, because
> that only creates half of an array (or 0.01% of one), the empty
> version that needs to be populated.  A natural array factory API
> [...]
> The interface would look something like one of these:
>
> interface ArrayContent<T> { int size(); T get(int i); }
> interface ArrayContent<T> { int size(); Iterator<T> iterator(); }
> interface ArrayContent<T> { int count(); Stream<T> stream(); }
> interface ArrayContent<T> { Spliterator<T> elements(); } //must be SIZED

Wasn't it suggested somewhat recently that arrays themselves might be
retrofitted with this kind of interface?  It seems like it would make
sense for arrays to be able act as their own factories, bringing the
idea full circle.

-- 
- DML

Reply via email to