The API is pretty clear about the differences and/or relations between them:


Collection

The root interface in the collection hierarchy. A collection represents a group of objects, known as its elements. Some collections allow duplicate elements and others do not. Some are ordered and others unordered.

http://download.oracle.com/javase/6/docs/api/java/util/Collection.html

List

An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.

http://download.oracle.com/javase/6/docs/api/java/util/List.html

Set

A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction.

http://download.oracle.com/javase/6/docs/api/java/util/Set.html

Map

An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.

http://download.oracle.com/javase/6/docs/api/java/util/Map.html


Is there anything in particular you find confusing about the above? If so, please edit your original question. Thanks.

Answer from Bart Kiers on Stack Overflow
🌐
Medium
medium.com › @toimrank › collections-framework-c41014a2033e
Java Collections Framework. Collections framework help us to work… | by Imran Khan | Medium
September 5, 2022 - Elements maintain insertion order and can be access by using index. List items can be accessed in both forward and backward direction. List allows multiple duplicate values as well. ArrayList: ArrayList is a class which implements List interface.
Top answer
1 of 11
49

The API is pretty clear about the differences and/or relations between them:


Collection

The root interface in the collection hierarchy. A collection represents a group of objects, known as its elements. Some collections allow duplicate elements and others do not. Some are ordered and others unordered.

http://download.oracle.com/javase/6/docs/api/java/util/Collection.html

List

An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list.

http://download.oracle.com/javase/6/docs/api/java/util/List.html

Set

A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction.

http://download.oracle.com/javase/6/docs/api/java/util/Set.html

Map

An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.

http://download.oracle.com/javase/6/docs/api/java/util/Map.html


Is there anything in particular you find confusing about the above? If so, please edit your original question. Thanks.

2 of 11
12

A short summary of common java collections:

'Map': A 'Map' is a container that allows to store key=>value pair. This enables fast searches using the key to get to its associated value. There are two implementations of this in the java.util package, 'HashMap' and 'TreeMap'. The former is implemented as a hastable, while the latter is implemented as a balanced binary search tree (thus also having the property of having the keys sorted).

'Set': A 'Set' is a container that holds only unique elements. Inserting the same value multiple times will still result in the 'Set' only holding one instance of it. It also provides fast operations to search, remove, add, merge and compute the intersection of two sets. Like 'Map' it has two implementations, 'HashSet' and 'TreeSet'.

'List': The 'List' interface is implemented by the 'Vector', 'ArrayList' and 'LinkedList' classes. A 'List' is basically a collection of elements that preserve their relative order. You can add/remove elements to it and access individual elements at any given position. Unlike a 'Map', 'List' items are indexed by an int that is their position is the 'List' (the first element being at position 0 and the last at 'List.size()'-1). 'Vector' and 'ArrayList' are implemented using an array while 'LinkedList', as the name implies, uses a linked list. One thing to note is, unlike php's associative arrays (which are more like a Map), an array in Java and many other languages actually represents a contiguous block of memory. The elements in an array are basically laid out side by side on adjacent "slots" so to speak. This gives very fast lookup and write times, much faster than associative arrays which are implemented using more complex data structures. But they can't be indexed by anything other than the numeric positions within the array, unlike associative arrays.

To get a really good idea of what each collection is good for and their performance characteristics I would recommend getting a good idea about data structures like arrays, linked lists, binary search trees, hashtables, as well as stacks and queues. There is really no substitute to learning this if you want to be an effective programmer in any language.

You can also read the Java Collections trail to get you started.

🌐
Medium
neesri.medium.com › java-collections-hashmap-hashset-treeset-and-more-3b2136b875f9
Java Collections: HashMap, HashSet, TreeSet, and More | by A cup of JAVA coffee with NeeSri | Medium
July 20, 2025 - Java Collections: HashMap, HashSet, TreeSet, and More 1. HashMap The java.util.HashMap is an implementation of the Map interface that stores data as key-value pairs. Key Features: Extends AbstractMap …
🌐
Oracle
docs.oracle.com › javase › tutorial › collections › implementations › index.html
Lesson: Implementations (The Java™ Tutorials > Collections)
In each case, one implementation — HashSet, ArrayList, and HashMap — is clearly the one to use for most applications, all other things being equal. Note that the SortedSet and the SortedMap interfaces do not have rows in the table. Each of those interfaces has one implementation (TreeSet and TreeMap) and is listed in the Set and the Map rows.
🌐
Medium
medium.com › @menkashah060 › arraylist-list-set-map-collection-in-java-84672a156724
ArrayList, List, Set, Map(Collection)in java? | by Menkashah | Medium
January 11, 2024 - The List interface provides methods to add, remove, access, and manipulate elements in a sequential manner. The List interface is found in java.util package and inherits the Collection interface.
🌐
Medium
krishnabankar.medium.com › java-collection-framework-fdd34a2b6a62
Java Collection Framework. Set, List, Queue are Collection… | by Krishna Bankar | Medium
February 14, 2021 - — It can accessed through head, tail, next pointer. ii. Set : — java.util.Set; — Set is an Interface and extends Collection interface. — Set is an interface and HashSet, LinkedHashSet, TreeSet, EnumSet are implementation classes.
🌐
Java Guides
javaguides.net › 2022 › 09 › collections-quiz-in-java.html
Java Collections Quiz - MCQ - Multiple Choice Questions
November 5, 2024 - ... The set() method replaces the element at the specified position in the list. ... HashSet is an implementation of the Set interface, not Map. ... HashMap, LinkedHashMap, and TreeMap are implementation classes of the Map interface.
🌐
JavaTechOnline
javatechonline.com › home › collection mcq in java with answers explained
Collection MCQ In Java With Answers Explained - JavaTechOnline
May 3, 2026 - Explanation: HashMap provides an implementation of the Map interface. The Map interface is used for storing key-value pairs, and HashMap is one of its primary implementations. ArrayList and LinkedList implement the List interface, and TreeSet ...
🌐
W3Schools
w3schools.com › java › java_collections.asp
Java Collections Framework
The Java Collections Framework provides a set of interfaces (like List, Set, and Map) and a set of classes (ArrayList, HashSet, HashMap, etc.) that implement those interfaces. All of these are part of the java.util package.
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › collections-in-java-tutorial
Java Collections Tutorial: List, Set, Map & Queue | DigitalOcean
Master Java Collections Framework. Complete guide to List, Set, Map, Queue interfaces with ArrayList, HashMap, HashSet examples and best practices.
🌐
TutorialsPoint
tutorialspoint.com › article › difference-between-list-set-and-map-in-java
Difference between List, Set, and Map in Java
List, Map, and Set interfaces belong to the java.util package. They extend the Collection interface. The List and Set interfaces are used to add, remove, or update elements while the Map interface follows a key-value pair.
🌐
GeeksforGeeks
geeksforgeeks.org › java › difference-between-list-set-and-map-in-java
Difference between List, Set and Map in Java - GeeksforGeeks
June 6, 2026 - import java.util.*; public class ... using for-each loop for (String fruit : al) System.out.println(fruit); } } ... The Map interface is a part of the java.util package and is used to store data in the form of key-value ...
🌐
Sanfoundry
sanfoundry.com › java-mcqs-java-util-maps
Java.util - Maps Questions & Answers - Sanfoundry
December 29, 2025 - Answer: b Explanation: In Java, the Map interface represents a collection that maps keys to values. It stores key-value pairs, where each key is unique. Implementations of Map include HashMap, TreeMap, and Hashtable.
🌐
C# Corner
c-sharpcorner.com › home › technologies › java › set interface and map interface in java.util package
Set Interface and Map Interface in java.util Package
June 26, 2024 - This implements java.util.Map the interface and use the tree for storage. It provides the ordered map. The following program uses both the HashMap and TreeMap classes to display a list of names associated with keys. The Map Interface contains methods to add, remove, find, and get objects using ...
🌐
Old Dominion University
cs.odu.edu › ~zeil › cs361 › latest › Public › treeSetsMaps › index.html
Tree-Based Sets and Maps
We’ve seen one set of classed providing these interfaces, HashSet and HashMap. As this module is devoted to binary search trees, it should be no great surprise that Java provides tree-based implementations. For sets, the tree-based implementation is java.util.TreeSet.
🌐
Blogger
java-latte.blogspot.com › 2013 › 09 › java-collection-arraylistvectorlinkedli.html
Java-Latte: Java Collection : ArrayList, Vector, LinkedList, HashSet, LinkedHashSet, TreeSet, HashMap, Hashtable, LinkedHashMap, TreeMap
The Collections Framework in the java.util package is loaded with interfaces and utilities. What Is a Collections Framework? A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain the following:
🌐
CodeBegun
codebegun.com › home › learn › java › collections › map interface in java: hashmap, treemap and more
Map Interface in Java: HashMap, TreeMap and More | CodeBegun
July 14, 2026 - Learn the Map interface in Java: HashMap, LinkedHashMap, TreeMap and Hashtable compared, with code examples, complexity tables and interview tips.
🌐
BtechSmartClass
btechsmartclass.com › java › java-Map-interface-Classes.html
Java Tutorials - HashMap | LinkedHashMap | TreeMap
The java collection framework has an interface Map that is available inside the java.util package. The Map interface is not a subtype of Collection interface. The Map interface has the following three classes. Now, let's look at each class in detail with example programs.
🌐
W3Schools
w3schools.com › java › java_arraylist.asp
Java ArrayList
An ArrayList is like a resizable array. It is part of the java.util package and implements the List interface.
🌐
Great Learning
mygreatlearning.com › blog › it/software development › collections in java – java collection framework
Collections in Java - Java Collection Framework
September 3, 2024 - Map Interface implemented using following classes:- ... The list is a child interface of Collections in java. Insertion order preserved i.e., They appear in the same order in which we inserted. Duplicate elements are allowed. List Interface is ...