Collection Framework Tutorials
- Collection framework provides a way to store group of similar objects as a single unit/entity.
Here is the index for Java Collection framework concepts
Collection Framework
- Introduction to collection framework
- Collection interface
- Collection overview for interview preparation
List
- List interface
- ArrayList class
- LinkedList class
- Vector class
- Stack class
- ArrayList v/s Vector
- ArrayList v/s LinkedList
- List v/s Set
Set
- Set interface
- HashSet class
- LinkedHashSet class
- SortedSet interface
- NavigableSet interface
- TreeSet class
- HashSet v/s LinkedHashSet
- HashSet v/s LinkedHashSet v/s TreeSet
- List v/s Set
- HashMap v/s HashSet
Queue
Cursors
Iterating Collection
- Various ways to iterate through ArrayList
- Various ways to iterate through Vector – 5 ways
- Various ways to iterate through LinkedList – 5 ways
- Various ways to iterate through HashSet – 3 ways
- How to reverse LinkedHashSet contents
- Various ways to iterate through TreeSet – 3 ways
- Various ways to iterate over List of HashMap in Java
- Various ways to iterate Arrays in Java – 5 ways
Iterating Collection in Java 8
- Iterating List using forEach() in Java 8
- Iterating Set using forEach() in Java 8
- Iterating Map using forEach() in Java 8
Comparable & Comparator
Sorting Collection
- Sorting ArrayList using Comparable and Comparator
- Sorting ArrayList in descending order
- How to sort Vector using Collections.sort()
- Sorting list of objects on multiple fields using Comparator in Java
- Sorting HashSet contents in ascending and descending order
- How to Sort HashSet in Java – 2 ways
- How to sort HashSet in Java 8 ?
- How to sort LinkedHashSet contents in Java ?
- Sorting Collection of String, StringBuffer and StringBuilder in Java
Map
- Map interface
- Entry interface
- HashMap class
- LinkedHashMap class
- IdentityHashMap class
- WeakHashMap class
- SortedMap interface
- NavigableMap interface
- TreeMap class
- Hashtable class
- HashMap vs LinkedHashMap
- HashMap v/s LinkedHashMap v/s TreeMap
- HashMap v/s HashSet
- HashMap v/s Hashtable
- Properties class
Iterating Map
- Various ways to iterate through HashMap – 5 ways
- To reverse order the LinkedHashMap contents
- Various ways to iterate through TreeMap – 5 ways
- Various ways to iterate through Hashtable – 6 ways
- Various ways to iterate over HashMap of ArrayList in Java
Sorting Map
- Converting Unordered HashMap into Sorted TreeMap
- Sorting HashMap by Keys and Values
- How to sort LinkedHashMap by its Keys ?
- How to sort LinkedHashMap by its Values ?
- Sorting Hashtable contents
- Sorting HashMap by Keys and Values using stream in Java 8
Collections class
- Collections class – utility class for Collection
- Sorting ArrayList using Comparable and Comparator
- Searching element from ArrayList using Binary Search Algorithm
- How to Reverse order of elements in ArrayList
- How to Reverse order of Comparator
- How to count duplicate elements of ArrayList
- How to swap elements of ArrayList
- How to copy elements of one ArrayList to another List
- How to shuffle elements of ArrayList
Synchronized version
- How to get synchronized version of List
- How to get synchronized version of Set
- How to get synchronized version of Map
- How to get synchronized version Collection
Arrays
- Arrays class
- Searching element from Arrays using Binary Search Algorithm
- Arrays v/s ArrayList
- Various ways to iterate Arrays in Java – 5 ways
- Various ways to remove duplicate elements from Arrays in Java – 5 ways
- How to find duplicate in String Arrays ?
Array Sorting
- Byte Array sorting
- char Array sorting
- short Array sorting
- Integer Array sorting
- Float Array sorting
- Double Array sorting
- Long Array sorting
- String Array sorting
- String Array sorting in ascending & descending order
- Sorting after merging two String Array
- Sorting Arrays using Comparable and Comparator
ArrayList operation
- Creating ArrayList using nCopies method of Collections class
- How to get size or length of an ArrayList
- Adding element to ArrayList at specified index position
- Remove element from ArrayList at specified index position
- How to delete a element and delete all elements of an ArrayList
- How to get sublist from ArrayList
- How to check whether particular element is present in ArrayList
- Comparing two ArrayList objects using containsAll() method
- Adding one ArrayList to another ArrayList using addAll() method
- Replacing ArrayList element with new value using set() method
- How to get maximum element from ArrayList
- How to get minimum element from ArrayList
- Various ways to iterate through ArrayList
- How to reverse ArrayList contents
- Sorting ArrayList in descending order
- Sorting ArrayList using sort() method of List in Java 8
- Sorting list of objects on multiple fields using Comparator in Java
- Remove duplicate elements from ArrayList in Java
- How to remove duplicate elements of ArrayList maintaining insertion order
LinkedList operation
- Iterating LinkedList in reverse order
- LinkedList specific method examples
- Push and pop operations with LinkedList
Set operation
- How to get size or length of HashSet
- How to delete a element and delete all elements of HashSet
- retainAll() method explanation with HashSet
- How to check whether particular element is present in HashSet
- Comparing two HashSet objects using containsAll() method
- Adding one HashSet to another HashSet using addAll() method
- Various ways to iterate through HashSet
- How to reverse LinkedHashSet contents
- Sorting HashSet contents in ascending and descending order
- How to Sort HashSet in Java – 2 ways
Map operation
- How to get all keys of a HashMap
- How to get all values of a HashMap
- How to get all Entries or Key-Value pairs of HashMap
- How to get size or length of HashMap
- How to check whether a particular key is present in HashMap
- How to check whether a particular value is present in HashMap
- How to check whether HashMap is empty or not ?
- Adding one HashMap to another HashMap using putAll method
- How to delete an entry of HashMap
- How to delete all entries of HashMap
- How to remove an entry from HashMap by comparing values in Java 8
- How to remove an entry from HashMap by comparing keys in Java 8
- Various ways to iterate through HashMap
- To reverse order the LinkedHashMap contents
- Map: How ConcurrentModificationException can be handled in Java
Conversion and how-to programs
- Conversion of Arrays to List
- Conversion of Arrays to List in Java 8
- Conversion of ArrayList to Arrays in Java – 2 ways
- Conversion of Arrays to Vector
- Conversion of Arrays to HashSet
- Conversion of HashSet to Arrays
- Conversion of LinkedList into Vector
- Conversion of ArrayList into HashSet to remove duplicate elements
- How to convert LinkedList to contain unique elements in ascending order
- Converting Ordered ArrayList into Sorted TreeSet
- Conversion of Map to List in Java
- Conversion of Map to List in Java 8
- Conversion of List to Map in Java
- Conversion of List to Map in Java 8
- How to remove elements while iterating collection object
Interview Question & Answers
Suggest tutorials from Contact Us page