A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
Java in General
Arrays.asList() Vs new ArrayList()
Joined: Oct 21, 2007
Dec 19, 2012 10:05:32
What is the difference between following two code snippets:
1. List<T> list = new
2. List<T> list = Arrays.asList(arrayObj);
Joined: Jan 28, 2003
Dec 19, 2012 10:09:38
The key is in what Arrays.asList() creates. See the API:
Which is here
. From the method description you should recognize the major difference between the two.
Joined: Aug 05, 2005
Dec 19, 2012 10:09:42
1 gives you a reference to an
2 gives you a reference to an instance of a class that implements the List interface.
I agree. Here's the link:
subject: Arrays.asList() Vs new ArrayList()
error in output
Updating page when uploading files
Getting Session on web service client
groovy's html builder....
JSF 2.0 MyConverter.getAsObject(...) how to get a handle on the backing bean
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014