This tutorial is a one-stop shop for all the Java collections interfaces, implementation classes, interface questions and answers, practical examples, utility methods, etc.
The Java Collections Tutorial source code examples have been written using the latest version of JDK. The source code examples and practices described in this tutorial have been well-tested in our development environment.
YouTube Video - Java Collections Framework Course
Core Interfaces
- Collections Framework - The Collection Interface
- Collections Framework - The Set Interface
- Collections Framework - The SortedSet Interface
- Collections Framework - The List Interface
- Collections Framework - The Queue Interface
- Collections Framework - The Deque Interface
- Collections Framework - The Map Interface
- Collections Framework - The SortedMap Interface
List Implementations
General-Purpose List Implementations:
Special-Purpose List Implementations:
Set Implementations
General-Purpose Set Implementations:
Special-Purpose Set Implementations:
General-purpose Map Implementations:Map Implementations
- Collections Framework - HashMap Class
- Collections Framework - LinkedHashMap Class
- Collections Framework - TreeMap class
- Collections Framework - EnumMap
- Collections Framework - WeakHashMap
- Collections Framework - IdentityHashMap
Concurrent Map Implementations:
Sorting
Aggregate Operations(Streams)
Collections Helper/Utility Classes
- Java Collections Utility Class(Development)
- 18 Useful Collections Utility Methods (Development)
- Java Custom User-Defined CollectionUtils Class(Development)
Conversion Collections Examples
- Conversion Between Array and Set in Java
- Conversion Between Array and List in Java
- Java Convert Map to Set Example
- Java Convert Map to List Example
- Java Convert Map to Array Example
- Convert a Map to an Array, List, and Set in Java
- Java 8 Convert List to Map Example
- Java 8 - Merging Two Maps Example
- Java Convert Array to String [Snippet]
- Convert List to Set in Java
- Convert Set to List in Java
- Convert Keys of Map to List in Java
- Convert List to an Array in Java
- Convert Array to List in Java
- Convert Stream to List in Java
- Convert Stream to Set in Java
- Convert Stream to Map in Java
- Convert Map to Properties in Java
- Convert Properties to Map in Java
- Convert Stream to List in Java
- Convert Stream to Set in Java
- Convert Stream to Map in Java
- Convert Map to Properties in Java
- Convert Properties to Map in Java
Collections Examples
- Java LinkedHashMap Example
- Java HashSet Example
- Java LinkedList Example
- Java ArrayList Example
- Java Comparator Interface Example
- Java Comparable Interface Example
- Java IdentityHashMap Example
- Java WeakHashMap Example
- Java EnumMap Example
- Java CopyOnWriteArraySet Example
- Java EnumSet Class Example
- Guide to Java 8 forEach Method
- Different Ways to Iterate over a List in Java [Snippet]
- Different Ways to Iterate over a Set in Java [Snippet]
- Different Ways to Iterate over a Map in Java [Snippet]
- Iterate over TreeSet in Java Example
- Iterate over LinkedHashSet in Java Example
- Remove the First and Last Elements of LinkedList in Java
- Iterate over LinkedList using an Iterator in Java
- Search an Element in an ArrayList in Java
- Iterate over ArrayList using Iterator in Java
- Remove Element from HashSet in Java
- Iterating over a HashSet using Iterator
- How To Remove Duplicate Elements From ArrayList In Java?
- Different Ways to Iterate over List, Set, and Map in Java
- Java ArrayList CRUD Operations Example
- Java LinkedList CRUD Operations Example
- Java HashSet CRUD Operations Example
- Java HashMap CRUD Operations Example
- HashMap getOrDefault() Method Example
- List get() Method Example
- Scanner nextInt() Method Example
- HashMap keySet() Method Example
- HashMap entrySet() Method Example
- Scanner nextLine() Method Example
- HashMap put() Method Example
- HashMap remove() Method Example
- ArrayList forEach() Method Example
- Java Find Max Min in Array
- Clone an Array in Java
- Sort a List in Java
- Sort a Set in Java
- Sort a Map by Key in java
- Sort Map by Value in Java
- How to Filter a List in Java
- How to Filter a Set in Java
- How to Filter a Map in Java
- How to Find an Element in a List with Java
- How to Find an Element in a Set with Java
- How to Find an Element in a Map with Java
- Custom Sort List in Java
- Custom Sort Set in Java
- Create Read-Only List in Java
- Create Read-Only Set in Java
- Create Read-Only Map in Java
Interview QA - Differences
- Difference Between List and Set in Java
- Difference Between Collection and Collections in Java
- Difference Between Array and ArrayList in Java
- Difference between ArrayList and LinkedList in Java
- Difference Between HashSet and LinkedHashSet in Java
- Difference Between HashSet and TreeSet in Java
- HashSet vs LinkedHashSet vs TreeSet in Java
- Difference Between HashMap and HashTable in Java
- Difference Between HashSet and HashMap in Java
- HashMap vs LinkedHashMap in Java
- Difference between HashMap, LinkedHashMap, and TreeMap in Java
- Collections vs. Streams in Java
- ArrayDeque vs LinkedList in Java
- ConcurrentHashMap vs HashMap in Java
- PriorityQueue vs LinkedList in Java
- WeakHashMap vs HashMap in Java
- IdentityHashMap vs HashMap in Java
- CopyOnWriteArraySet vs HashSet in Java
- SynchronizedMap vs ConcurrentHashMap in Java
- TreeMap vs LinkedHashMap in Java
- EnumSet vs HashSet in Java
- EnumMap vs HashMap in Java
- Queue vs Stack in Java
- NavigableMap vs SortedMap in Java
- NavigableSet vs SortedSet in Java
- Iterable vs Collection in Java
YouTube Video Series - Java Collections Framework in Depth Series
- Java Collections Framework in Depth - 1 - Need for Collections Framework
- Java Collections Framework in Depth - 2 - Collections Framework Hierarchy
- Java Collections Framework in Depth - 3 - Collection Interface with Coding Example
- Java Collections Framework in Depth - 4 - List Interface with Coding Example
- Java Collections Framework in Depth - 5 - ArrayList Class Overview
- Java Collections Framework in Depth - 6 - Creating an ArrayList and Adding New Elements to It
- Java Collections Framework in Depth - 7 - Creating ArrayList from Another Collection
- Java Collections Framework in Depth - 8 - Accessing Elements from an ArrayList
- Java Collections Framework in Depth - 9 - Removing Elements from an ArrayList
- Java Collections Framework in Depth - 10 - Iterating Over an ArrayList (6 Ways)
- Java Collections Framework in Depth - 11 - ListIterator Interface with Coding Example
- Java Collections Framework in Depth - 12 - CopyOnWriteArrayList Class with Coding Example
- Java Collections Framework in Depth - 13 - LinkedList Overview | ArrayList vs LinkedList
- Java Collections Framework in Depth - 14 - Create LinkedList Example | add(), and first and addLast()
- Java Collections Framework in Depth - 15 - Retrieving Elements from a LinkedList
- Java Collections Framework in Depth - 16 - Removing Elements from a LinkedList
- Java Collections Framework in Depth - 18 - HashSet Class Overview | Key Points to Note
The complete YouTube playlist at Learn Java Collections Framework
Best Practices and Interviews
- Java Collection Framework Best Practice (Best Practice)
- How does the Size of the ArrayList Increase Dynamically? (interview)
- How To Remove Duplicate Elements From ArrayList In Java? (interview)
Java ArrayList API Guides
- Java ArrayList add() Method
- Java ArrayList addAll() Method
- Java ArrayList addFirst() Method
- Java ArrayList addLast() Method
- Java ArrayList clear() Method
- Java ArrayList clone() Method
- Java ArrayList contains() Method
- Java ArrayList ensureCapacity() Method
- Java ArrayList equals() Method
- Java ArrayList forEach() Method
- Java ArrayList get() Method
- Java ArrayList indexOf() Method
- Java ArrayList isEmpty() Method
- Java ArrayList iterator() Method
- Java ArrayList lastIndexOf() Method
- Java ArrayList listIterator() Method
- Java ArrayList removeAll() Method
- Java ArrayList remove() Method
- Java ArrayList removeFirst() Method
- Java ArrayList removeLast() Method
- Java ArrayList retainAll() Method
- Java ArrayList spliterator() Method
- Java ArrayList subList() Method
- Java ArrayList toArray() Method
- Java ArrayList trimToSize() Method
Java HashMap API Guides
- Java HashMap put() Method
- Java HashMap clear() Method
- Java HashMap containsKey() Method
- Java HashMap containsValue() Method
- Java HashMap get() Method
- Java HashMap isEmpty() Method
- Java HashMap putAll() Method
- Java HashMap remove() Method
- Java HashMap size() Method
- Java HashMap entrySet() Method
- Java HashMap keySet() Method
- Java HashMap getOrDefault() Method
- Java HashMap putIfAbsent() Method
- Java HashMap remove(Object key, Object value) Method
- Java HashMap replace() Method
- Java HashMap forEach() Method
- Java HashMap compute() Method
- Java HashMap computeIfAbsent() Method
- Java HashMap merge() Method
- Java HashMap keySpliterator() Method
- Java HashMap valueSpliterator() Method
- Java HashMap entrySpliterator() Method
- Java HashMap keySet().stream() Method
- Java HashMap entrySet().stream() Method
- Java HashMap values() Method
- Java HashMap replaceAll() Method
Java HashSet API Guides
- Java HashSet add() Method
- Java HashSet clear() Method
- Java HashSet clone() Method
- Java HashSet isEmpty() Method
- Java HashSet iterator() Method
- Java HashSet newHashSet() Method (Introduced in Java 21)
- Java HashSet remove() Method
- Java HashSet size() Method
- Java HashSet spliterator() Method
- Java HashSet toArray() Method
- Java HashSet addAll() Method
- Java HashSet containsAll() Method
- Java HashSet removeAll() Method
- Java HashSet retainAll() Method
- Java HashSet stream() Method
- Java HashSet parallelStream() Method
- Java HashSet forEach() Method
- Java HashSet removeIf() Method
Java LinkedHashMap API Guides
- Java LinkedHashMap put() Method
- Java LinkedHashMap clear() Method
- Java LinkedHashMap clone() Method
- Java LinkedHashMap containsKey() Method
- Java LinkedHashMap get() Method
- Java LinkedHashMap isEmpty() Method
- Java LinkedHashMap putAll() Method
- Java LinkedHashMap remove() Method
- Java LinkedHashMap size() Method
- Java LinkedHashMap entrySet() Method
- Java LinkedHashMap keySet() Method
- Java LinkedHashMap values() Method
- Java LinkedHashMap getOrDefault() Method
- Java LinkedHashMap replace() Method
- Java LinkedHashMap replace(K key, V value) Method
- Java LinkedHashMap forEach() Method
- Java LinkedHashMap replaceAll() Method
- Java LinkedHashMap computeIfAbsent() Method
- Java LinkedHashMap merge() Method
- Java LinkedHashMap keySpliterator() Method
- Java LinkedHashMap valueSpliterator() Method
- Java LinkedHashMap entrySpliterator() Method
- Java LinkedHashMap valueStream() Method
- Java LinkedHashMap entryStream() Method
Java LinkedHashSet API Guides
- Java LinkedHashSet add() Method
- Java LinkedHashSet clear() Method
- Java LinkedHashSet contains() Method
- Java LinkedHashSet isEmpty() Method
- Java LinkedHashSet iterator() Method
- Java LinkedHashSet remove() Method
- Java LinkedHashSet size() Method
- Java LinkedHashSet addFirst() Method (Introduced in Java 21)
- Java LinkedHashSet addLast() Method (Introduced in Java 21)
- Java LinkedHashSet getFirst() Method (Introduced in Java 21)
- Java LinkedHashSet getLast() Method (Introduced in Java 21)
- Java LinkedHashSet newLinkedHashSet() Method (Introduced in Java 21)
- Java LinkedHashSet removeFirst() Method (Introduced in Java 21)
- Java LinkedHashSet spliterator() Method
- Java LinkedHashSet addAll() Method
- Java LinkedHashSet removeLast() Method (Introduced in Java 21)
- Java LinkedHashSet reversed() Method (Introduced in Java 21)
- Java LinkedHashSet containsAll() Method
- Java LinkedHashSet retainAll() Method
- Java LinkedHashSet removeAll() Method
- Java LinkedHashSet toArray() Method
- Java LinkedHashSet parallelStream() Method
- Java LinkedHashSet stream() Method
- Java LinkedHashSet forEach() Method
Java ConcurrentHashMap API Guides
- Java ConcurrentHashMap put() Method
- Java ConcurrentHashMap get() Method
- Java ConcurrentHashMap containsKey() Method
- Java ConcurrentHashMap containsValue() Method
- Java ConcurrentHashMap remove() Method
- Java ConcurrentHashMap size() Method
- Java ConcurrentHashMap isEmpty() Method
- Java ConcurrentHashMap keySet() Method
- Java ConcurrentHashMap values() Method
- Java ConcurrentHashMap putIfAbsent() Method
- Java ConcurrentHashMap replace() Method
- Java ConcurrentHashMap forEach() Method
- Java ConcurrentHashMap keys() Method
Java CopyOnWriteArrayList API Guides
- Java CopyOnWriteArrayList add() Method
- Java CopyOnWriteArrayList get() Method
- Java CopyOnWriteArrayList size() Method
- Java CopyOnWriteArrayList isEmpty() Method
- Java CopyOnWriteArrayList clear() Method
- Java CopyOnWriteArrayList indexOf() Method
- Java CopyOnWriteArrayList indexOf() Method
- Java CopyOnWriteArrayList lastIndexOf() Method
- Java CopyOnWriteArrayList addAll() Method
- Java CopyOnWriteArrayList remove() Method
- Java CopyOnWriteArrayList iterator() Method
Java CopyOnWriteArraySet API Guides
- Java CopyOnWriteArraySet add() Method
- Java CopyOnWriteArraySet remove() Method
- Java CopyOnWriteArraySet contains() Method
- Java CopyOnWriteArraySet size() Method
- Java CopyOnWriteArraySet isEmpty() Method
- Java CopyOnWriteArraySet clear() Method
- Java CopyOnWriteArraySet iterator() Method
- Java CopyOnWriteArraySet toArray() Method
- Java CopyOnWriteArraySet addAll() Method
- Java CopyOnWriteArraySet containsAll() Method
- Java CopyOnWriteArraySet removeAll() Method
- Java CopyOnWriteArraySet retainAll() Method
Java EnumMap API Guides
- Java EnumMap put() Method
- Java EnumMap get() Method
- Java EnumMap containsKey() Method
- Java EnumMap size() Method
- Java EnumMap isEmpty() Method
- Java EnumMap keySet() Method
- Java EnumMap values() Method
- Java EnumMap entrySet() Method
- Java EnumMap forEach() Method
- Java EnumMap getOrDefault() Method
- Java EnumMap putIfAbsent() Method
- Java EnumMap remove() Method
Java EnumSet API Guides
- Java EnumSet allOf() Method
- Java EnumSet noneOf() Method
- Java EnumSet of() Method
- Java EnumSet complementOf() Method
- Java EnumSet copyOf Method
- Java EnumSet add() Method
- Java EnumSet addAll() Method
- Java EnumSet contains() Method
- Java EnumSet containsAll() Method
- Java EnumSet remove() Method
- Java EnumSet removeAll() Method
- Java EnumSet retainAll() Method
- Java EnumSet clear() Method
Java IdentityHashMap API Guides
- Java IdentityHashMap put() Method
- Java IdentityHashMap putAll() Method
- Java IdentityHashMap get() Method
- Java IdentityHashMap containsKey() Method
- Java IdentityHashMap containsValue() Method
- Java IdentityHashMap entrySet() Method
- Java IdentityHashMap values() Method
- Java IdentityHashMap size() Method
- Java IdentityHashMap isEmpty() Method
- Java IdentityHashMap keySet() Method
Java PriorityQueue API Guides
- Java PriorityQueue add() Method
- Java PriorityQueue clear() Method
- Java PriorityQueue comparator() Method
- Java PriorityQueue contains() Method
- Java PriorityQueue forEach() Method
- Java PriorityQueue iterator() Method
- Java PriorityQueue offer() Method
- Java PriorityQueue peek() Method
- Java PriorityQueue poll() Method
- Java PriorityQueue remove() Method
- Java PriorityQueue removeAll() Method
- Java PriorityQueue removeIf() Method
- Java PriorityQueue retainAll() Method
- Java PriorityQueue size() Method
- Java PriorityQueue spliterator() Method
- Java PriorityQueue toArray() Method
Java ArrayDeque API Guides
- Java ArrayDeque add() Method
- Java ArrayDeque addAll() Method
- Java ArrayDeque addFirst() Method
- Java ArrayDeque addLast() Method
- Java ArrayDeque clear() Method
- Java ArrayDeque clone() Method
- Java ArrayDeque contains() Method
- Java ArrayDeque descendingIterator() Method
- Java ArrayDeque element() Method
- Java ArrayDeque forEach() Method
- Java ArrayDeque getFirst() Method
- Java ArrayDeque getLast() Method
- Java ArrayDeque isEmpty() Method
- Java ArrayDeque offer() Method
- Java ArrayDeque offerFirst() Method
- Java ArrayDeque iterator() Method
- Java ArrayDeque offerLast() Method
- Java ArrayDeque peek() Method
- Java ArrayDeque peekFirst() Method
- Java ArrayDeque peekLast() Method
- Java ArrayDeque poll() Method
- Java ArrayDeque pollFirst() Method
- Java ArrayDeque pollLast() Method
- Java ArrayDeque pop() Method
- Java ArrayDeque push() Method
- Java ArrayDeque remove() Method
- Java ArrayDeque removeAll() Method
- Java ArrayDeque removeFirst() Method
- Java ArrayDeque removeFirstOccurrence() Method
- Java ArrayDeque removeIf() Method
- Java ArrayDeque removeLast() Method
- Java ArrayDeque removeLastOccurrence() Method
- Java ArrayDeque retainAll() Method
- Java ArrayDeque size() Method
- Java ArrayDeque spliterator() Method
- Java ArrayDeque toArray() Method
Java Stack API Guides
- Java Stack empty() Method
- Java Stack peek() Method
- Java Stack pop() Method
- Java Stack push() Method
- Java Stack search() Method
Java Scanner API Guides
- Java Scanner close() Method
- Java Scanner delimiter() Method
- Java Scanner findAll() Method
- Java Scanner findInLine() Method
- Java Scanner hasNext() Method
- Java Scanner hasNextInt() Method
- Java Scanner hasNextLine() Method
- Java Scanner match() Method
- Java Scanner next() Method
- Java Scanner nextBigDecimal() Method
- Java Scanner nextBigInteger() Method
- Java Scanner nextBoolean() Method
- Java Scanner nextByte() Method
- Java Scanner nextDouble() Method
- Java Scanner nextFloat() Method
- Java Scanner nextInt() Method
- Java Scanner nextLine() Method
- Java Scanner nextLong() Method
- Java Scanner nextShort() Method
- Java Scanner tokens() Method
- Java Scanner useDelimiter() Method
Guides to Java Collections Framework Classes and Interfaces
- Java Hashtable Class
- Java ListIterator
- Java Locale Class
- Java NavigableMap Interface
- Java NavigableSet Interface
- Java NoSuchElementException Class
- Java Optional
- Java OptionalDouble Class
- Java OptionalInt Class
- Java OptionalLong Class
- Java PriorityQueue
- Java Properties Class
- Java Queue Interface
- Java Scanner
- Java SequencedCollection Interface
- Java SequencedMap Interface
- Java SequencedSet Interface
- Java SortedMap Interface
- Java SortedSet Interface
- Java Spliterator Interface
- Java Stack Class
- Java ArrayDeque
- Java Base64 Class
- Java Calendar Class
- Java ConcurrentModificationException
- Java Currency Class
- Java Date Class
- Java Deque
- Java Formattable Interface
- Java Formatter Class
Productive tutorial. Top Java blog web site with up-to-date tutorials, guides, articles. Highly recommended to every Java beginners and developers.
ReplyDeleteAwesome resources for learning java. I am daily going through it.
ReplyDeleteThank you.
Delete