Streams factories in Stream (original) (raw)

Peter Levart peter.levart at gmail.com
Wed Apr 24 00:43:44 PDT 2013


On 04/24/2013 08:18 AM, John Rose wrote:

On Apr 23, 2013, at 10:59 PM, Peter Levart <peter.levart at gmail.com_ _<mailto:peter.levart at gmail.com>> wrote:

And if the translation used invokedynamic to obtain a cached empty array of a particular element type (like lambda metafactory does for lambdas), the overhead to obtain such would be minimal. Good point. I was thinking of clunkier things like Arrays.EMPTYOBJECTARRAY or private synthetic constants. — John

There would at least have to be Arrays.EMPTY_OBJECT_ARRAY and private synthetic constants since the spec. requires that this code works:

public static T[] array(T ... elements) { return elements; }

... String[] strings = array(); Integer[] integers = array(); ... ...

It would be nice to have a method like above in j.u.Arrays then.

Regards, Peter



More information about the lambda-dev mailing list