Login with  Log in with facebook
Hiring Manager? SIGN UP HERE
4

What is the difference between java.util.Collection and java.util.List in Java.

Rishi Yadav
10/25/2011 at 17:58
2 Answers
1
1

Collection represents a group of objects known as its elements. The Collection interface is used to pass around collections of objects where maximum generality is desired.

A List is an ordered Collection. Lists may contain duplicate elements.Listinterface also includes operations for the following:

  • Positional access — manipulates elements based on their numerical position in the list
  • Search — searches for a specified object in the list and returns its numerical position
  • Iteration — extends Iterator semantics to take advantage of the list's sequential nature
  • Range-view — performs arbitrary range operations on the list.

Sunita Priyadarsini Pokkunuri
10/25/2011 at 18:19

2
0

List interface extends Collection Interface.

Collection interface is top in the hierarchy , collections interface provides methods to play around group of objects like adding a element in collection, removing an element in collection, adding a complete collection in a collection while List in addition to above collection methods , you have more methods such as adding an element at particular index, removing an element from particular index, adding a collection at particular index etc..

Ankit Dhiman
01/14/2012 at 23:53

If you want to post any answer to this forum then you need to log in.
Schedule a Demo

Schedule a Demo with us

Name *
Email *
Phone *
Company *
Details