What is the difference between List, Set and Map?

What is the difference between List, Set and Map?

List is an ordered collection of elements by index. Key methods of List are : get(int index), indexOf(Object o), add(int index, Object o), etc.

A Set cares about Uniqueness, it doesn\'t allow duplicates elements. The equals() method helps you to find out whether two objects are identical.

A map stores the elements in the form of Key/Value pairs. Here key and value both are objects. A map cares about unique key (unique ID) to a specific value. You can search value in a Map by giving its key.

By:Jalees
Date:2016-01-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related Java Subjective Links

Java Subjective interview questions and answers for experienced and fresher