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
🌐
GeeksforGeeks
geeksforgeeks.org › java › difference-between-list-set-and-map-in-java
Difference between List, Set and Map in Java - GeeksforGeeks
June 6, 2026 - List stores elements in an ordered sequence and allows duplicate values. Set stores only unique elements and does not allow duplicates. Map stores data in the form of key-value pairs, where each key must be unique.
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.

🌐
Java67
java67.com › 2013 › 01 › difference-between-set-list-and-map-in-java.html
Difference between Set, List and Map in Java - Interview question | Java67
List in Java provides ordered and indexed collection which may contain duplicates. The Set interface provides an unordered collection of unique objects, i.e. Set doesn't allow duplicates, while Map provides a data structure based on key-value ...
🌐
BeginnersBook
beginnersbook.com › 2015 › 01 › difference-between-list-set-and-map-in-java
Difference between list set and map in java?
1) If you do not want to have duplicate values in the database then Set should be your first choice as all of its classes do not allow duplicates. 2) If there is a need of frequent search operations based on the index values then List (ArrayList) is a better choice.
🌐
TutorialsPoint
tutorialspoint.com › article › difference-between-list-set-and-map-in-java
Difference between List, Set, and Map in Java
The List and Set interfaces are used to add, remove, or update elements while the Map interface follows a key-value pair. Any amount of null values can be inserted in the List interface while only one null value is supported by Set.
🌐
Medium
shoaib-hasan1801.medium.com › set-vs-list-vs-map-in-java-8722d69b439a
Set VS List VS Map in Java. A collection is an object that groups… | by Shoaib Hasan | Medium
September 26, 2022 - Since elements are stored in a tree, the access and retrieval times are quite fast in a TreeSet. The elements are stored in ascending order in a TreeSet. ... Map is key-value pair collection in java.
🌐
Medium
medium.com › @cleitonestefenon › key-differences-between-list-set-and-map-in-the-java-collections-framework-a2d765e316ac
Key Differences Between List, Set, and Map in the Java Collections Framework | by Cleiton Estefenon | Medium
December 10, 2024 - Map<String, Integer> map = new ... System.out.println(map); // Output: {A=[5,6,6,7,7], B=[1,2,3]} Use List when order matters and duplicates are allowed....
🌐
Medium
medium.com › the-60-second-programmer › working-with-collections-in-java-list-set-and-map-️-0a581c06978c
Working with Collections in Java: List, Set, and Map 🗂️ | by Marcelo Domingues | The 60-Second Programmer | Medium
September 15, 2024 - Understanding when to use List, Set, or Map is key to writing efficient Java programs. Use a List for ordered data with duplicates, a Set for unique elements, and a Map for key-value pairs.
Find elsewhere
🌐
Substack
gauravrshegekar.substack.com › bytecraft › list vs set vs map in java
List vs Set vs Map in Java - by Gaurav Shegekar - ByteCraft
July 26, 2026 - Suppose you store student names. If duplicate names are allowed and the order should remain the same, a List is a good choice. If only unique names should be stored, a Set is more appropriate.
🌐
JavaMadeSoEasy
javamadesoeasy.com › 2016 › 02 › difference-between-list-set-and-map-in.html
JavaMadeSoEasy.com (JMSE): Difference between List, Set and Map in java
In this Collection framework tutorial we will learn Difference between List, Set and Map in java, it forms the base of java collection api.
🌐
Just Academy
justacademy.co › blog-detail › difference-between-list-set-and-map-in-java
Difference Between List Set And Map In Java by Roshan Chaturvedi | JustAcademy
In Java, a list is an ordered collection of elements that allows duplicates, a set is a collection that does not allow duplicates and does not maintain order, and a map is a collection of key-value pairs.
🌐
Prepare
prepare.sh › home › comparisons › list vs set vs map in java
List vs Set vs Map in Java | Prepare.sh
1 month ago - Three interfaces, one very common interview question, and one detail that trips people up before they even get to the differences: Map is not a Collection. List and Set both extend Collection and hold elements. Map holds pairs and sits outside that hierarchy entirely.
🌐
Techie Delight
techiedelight.com › home › java › difference between list, set, and map interface in java
Difference between List, Set, and Map interface in Java | Techie Delight
July 7, 2026 - List represents an ordered sequence in Java whose elements are accessible by index. Set represents a distinct collection of elements in Java which can be either ordered or unordered, depending on the implementation.
🌐
YouTube
youtube.com › watch
List Vs Set Vs Map in java collections | Java Interview - YouTube
This video brief about the Similarities and Difference between List, Set and Map in collection framework in java.#java #arraylist #vector #collection #coreja...
Published: February 4, 2022
🌐
Medium
medium.com › @lahirukavikara › java-collections-deep-dive-list-vs-set-vs-map-with-real-examples-06563907912a
Java Collections Deep Dive: List vs Set vs Map (With Real Examples) | by Lahirukavikara | Medium
April 20, 2026 - public class MapExample { public static void main(String[] args) { Map<Integer, String> employees = new HashMap<>(); employees.put(1, "Lahiru"); employees.put(2, "Pasindu"); employees.put(1, "Kasun"); // overrides key 1 System.out.println(employees); // Access by key System.out.println(employees.get(2)); } } ... | Feature | List (ArrayList) | Set (HashSet) | Map (HashMap) | | ----------- | ---------------- | ---------------- | ---------------- | | Order | ✅ Maintained | ❌ Not guaranteed | ❌ Not guaranteed | | Duplicates | ✅ Allowed | ❌ Not allowed | ❌ Keys only | | Access | Index-based | No index | Key-based | | Null values | ✅ Yes | ✅ One null | ✅ One null key | | Performance | Fast read | Fast lookup | Fast key access |
🌐
Vibrantpublishers
vibrantpublishers.com › blogs › blogs-on-programming › java-collections-list-set-queue-map
Java Collections – List, Set, Queue & Map
April 3, 2020 - Here you will begin at one end and work on the collection, item by item until you’ve finished processing all the items.To get each item in a list, you can do the following: Java Set is a collection construct that, by definition, contains unique elements — that is, no duplicates.
🌐
DEV Community
dev.to › be11amer › part-1-java-collections-framework-lists-sets-maps-and-collections-utility-class-o2d
Part 1: Java Collections Framework - Lists, Sets, Maps, and Collections Utility Class - DEV Community
August 3, 2025 - List: An ordered collection that allows duplicates. Set: A collection that does not allow duplicates. Map: Maps unique keys to values. Understanding these structures is critical for efficient data handling in Java.
🌐
Prgrmmng
prgrmmng.com › home › series › java collections › list vs set vs map in java – when and why to use each
List vs Set vs Map in Java – When and Why to Use Each | prgrmmng.com
August 14, 2025 - List<String> fruits = new ArrayList<>(); fruits.add("Apple"); fruits.add("Banana"); fruits.add("Apple"); // Allowed · Set<String> colors = new HashSet<>(); colors.add("Red"); colors.add("Red"); // Ignored · Map<String, Integer> stock = new HashMap<>(); stock.put("Apple", 50); stock.put("Banana", 100); stock.put("Apple", 60); // Overwrites
🌐
Medium
medium.com › @samurai.stateless.coder › lists-vs-sets-vs-maps-the-simple-decision-guide-every-java-developer-needs-d821ea9e7465
Lists vs Sets vs Maps: The Simple Decision Guide Every Java Developer Needs | by The Stateless Samurai | Medium
August 30, 2025 - Choose the right structure in 60 seconds and trade duplicate bugs, wasted memory, and noisy reviews for calm code that reads like the requirement. I make one clear claim: most collection pain comes from defaulting to the wrong type, then duct-taping the result. I have done it often. I reach for a List, then add dedup checks, then sort, then comment “order matters.” The real cost shows up as memory churn, strange p95 spikes, and brittle fixes that hide the core idea.
🌐
Medium
medium.com › java-tips-and-tricks › how-to-choose-the-right-java-collection-list-vs-set-vs-map-5905eea3a108
How to Choose the Right Java Collection (List vs Set vs Map) | by Renan Schmitt | Java Tips and Tricks | Medium
March 29, 2026 - If you’re starting your journey with Java, you’ll quickly notice something: there are many ways to create and use collections. ArrayList, List.of, Set.of, Map.of, streams, collectors… it can feel overwhelming at first. This article is here to simplify things, by the end, you’ll understand: The difference between mutable and immutable collections ... Mutable collections can be changed after creation: safer (no accidental changes), thread-safe by design, and preferred in modern Java.