Return types array/list/stream [was: API question for point lambdafication]

Tom Hawtin tom.hawtin at
Wed Feb 20 08:10:46 PST 2013

On 20/02/2013 11:17, Remi Forax wrote:

> Most of java.lang uses arrays instead of List to avoid too many
> dependencies between
> java.lang and java.util which cause nightmare during the booting
> sequence of the JDK.

Like many other packages, java.lang predates the Java2 collection 
framework, so has to use arrays. As practically everything already 
existing is using arrays, it's tricky to mix in collections just for new 
methods. It's a pity as "some things" is a pretty fundamental concept. 
Whereas a mutable, ordered collection of fixed size is an implementation 
detail that should be hidden away.

Dependency between packages does not fundamentally cause problems with 
start up. It's dependency between individual classes, irrespective of 
arbitrary package, which is important.

(It may be worth mentioning that implementation of fundamental types may 
be surprisingly complicated. For instance, HashMap currently does a lot 
of work to find a random number for some strange purpose.)


More information about the lambda-dev mailing list