A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Introducing JavaFX 8 Programming
this week in the
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()
Updating page when uploading files
groovy's html builder....
error in output
Getting Session on web service client
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-2015