RFR(s): 8060192: Add default method Collection.toArray(generator) (original) (raw)
David Lloyd david.lloyd at redhat.com
Tue Dec 12 14🔞38 UTC 2017
- Previous message: RFR(s): 8060192: Add default method Collection.toArray(generator)
- Next message: RFR(s): 8060192: Add default method Collection.toArray(generator)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Dec 11, 2017 at 8:00 PM, John Rose <john.r.rose at 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 { int size(); T get(int i); } interface ArrayContent { int size(); Iterator iterator(); } interface ArrayContent { int count(); Stream stream(); } interface ArrayContent { Spliterator 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
- Previous message: RFR(s): 8060192: Add default method Collection.toArray(generator)
- Next message: RFR(s): 8060192: Add default method Collection.toArray(generator)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]