toArray (original) (raw)
Remi Forax forax at univ-mlv.fr
Sun Dec 16 02:30:04 PST 2012
- Previous message: toArray
- Next message: toArray
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12/16/2012 01:08 AM, Brian Goetz wrote:
Seems that the minimally invasive version of toArray (that doesn't propagate the horrible convention established by Collection, and yet doesn't foist Object[] on users) is:
interface Stream { Object[] toArray(); T[] toArray(Class clazz); } It is unfortunate to need the Object[] version at all. However, code that is generic in T might be passed a Stream and not know what class literal to use. It is further unfortunate that we cannot say
S[] toArray(Classas then such code could say toArray(Object.class), but we cannot (this is a limitation of generics.)clazz)
why not ?
interface Stream { U[] toArray(Class clazz); }
Rémi
- Previous message: toArray
- Next message: toArray
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the lambda-libs-spec-experts mailing list