Click here to Skip to main content
15,903,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
What is the difference between Collection and List in Java? When and which I should use?
Posted

A Collection is just that: a collection of items. You can add stuff, remove stuff, iterate over stuff and query how much stuff is in there.
where as, A List adds the information about a defined sequence of stuff to it: You can get the element at position n, you can add an element at position n, you can remove the element at position n
Collection is the root interface to the java Collections hierarchy. whereas
A List is one sub interface which defines an ordered Collection, other sub interfaces are Queue which typically will store elements ready for processing (e.g. stack).
Reference Link :- What is the difference between Collection and List in Java?[^]
for more reference :-
Collection[^]
List[^]
 
Share this answer
 
 
Share this answer
 
Comments
hamzah1 20-Dec-11 9:34am    
Man the URL is Invalid
TorstenH. 20-Dec-11 9:57am    
??? works fine here. It's the oracle tutorial on collections, all the info is in there.
You should also be able to find it without direct link - it's nothing secret.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900