java source wrong?

K

K

Hi

I was looking at the Arrays.java file that comes with the jdk source code
and found the following:

public static <T> List<T> asList(T... a) {

return new ArrayList<T>(a);

}

The problem is that ArrayList doesn't have a constructor that takes an array
as a parameter and the above code will not compile when copied into one of
your own classes.

Is the java source wrong/incomplete or am I missing something?

thx in advance
 
S

Stefan Ram

K said:
return new ArrayList<T>(a);
Is the java source wrong/incomplete or am I missing something?

IIRC, I asked the same question before in this group.

I was told that Arrays.java contained an internal custom
implementation »private static class ArrayList<E>« and that
this had such a constructor IIRC.
 
K

K

thx for the fast reply.

Pretty confusing with the duplicate names, but it's there allright.

thx again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top