overloads for java.util.RandomAccess

Brian Goetz brian.goetz at oracle.com
Wed Oct 31 06:41:02 PDT 2012


Just to reiterate, the methods in Streams for constucting streams are very raw and need a complete overhaul.  So don't take them too seriously -- there's just enough there to make our tests work :)

On Oct 31, 2012, at 6:42 AM, Remi Forax wrote:

> On 10/31/2012 08:54 AM, Gernot Neppert wrote:
>> (Note: The current version has a performance issue, as the erased argument
>> type is not java.util.List, but rather java.util.RandomAccess, and there's
>> an invisible checked cast involved in every single invocation of any of
>> List's methods. Probably not what the author intended)
> 
> True,
> the signature should be
>   public static <T, L extends List<T> & RandomAccess> Stream<T> 
> stream(L source)
> 
> and I also agree with you that java.util.RandomAccess should not be used 
> as a type in a signature but to select the stream implementation at runtime.
> 
> regards,
> Rémi
> 
> 



More information about the lambda-dev mailing list