File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is the List class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is the List class" Watch "What is the List class" New topic
Author

What is the List class

Vidhya Ramaswamy
Ranch Hand

Joined: Oct 10, 2007
Posts: 65
As we know, List is an interface. So, which class does Arrays.asList() return exactly?

Rajasekar Elango
Ranch Hand

Joined: Sep 13, 2004
Posts: 105
This blog might help you..

- Rajasekar
[ December 10, 2007: Message edited by: Rajasekar Elango ]

SCJP 1.4
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

It doesn't matter. All you know is that whatever the class is, it implements the List interface.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vidhya Ramaswamy
Ranch Hand

Joined: Oct 10, 2007
Posts: 65
Thanks Rajasekar, that was helpful.

No wonder, the changes(using set()) made to the List view that is returned from Arrays.asList() is reflected in the original array.

But, if a new ArrayList object if created from Arrays.asList() :

and changes are made to this(using set()), it is not reflected in the original array.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the List class
 
Similar Threads
How can I descend this?
converting int array to List
Why is this happening? (ClassCastException)
Behavior of Arrays.asList()
Array of ArrayLists Possible?