This document compares common Java collection classes and their key properties. It outlines differences between common collection interfaces like List, Set, and Map in terms of order, duplicates allowed, null values, synchronization, underlying data structure, and initial capacity.
This document compares common Java collection classes and their key properties. It outlines differences between common collection interfaces like List, Set, and Map in terms of order, duplicates allowed, null values, synchronization, underlying data structure, and initial capacity.
This document compares common Java collection classes and their key properties. It outlines differences between common collection interfaces like List, Set, and Map in terms of order, duplicates allowed, null values, synchronization, underlying data structure, and initial capacity.
This document compares common Java collection classes and their key properties. It outlines differences between common collection interfaces like List, Set, and Map in terms of order, duplicates allowed, null values, synchronization, underlying data structure, and initial capacity.
Order Order by Insertion Order by Insertion Order by Insertion Order by Insertion Duplicates Allowed Allowed Allowed Allowed Null Value Allowed Allowed Allowed Allowed Synchronized Not Synchronized Not Synchronized Synchronized Synchronized Data Structure Resizable Array Double Linked List Resizable Array Resizable Array Initial Capacity 10 ------ 10 10
HashSet LinkedHsahSet TreeSet
Ordered Unordered Ordered by Insertion Sorted Order Duplicates Not Allowed Not Allowed Not Allowed Null Value Allowed Allowed Allowed Synchronized Not Synchronized Not Synchronized Not Synchronized Data Structure Hashtable Hashtable + double Linked list Balanced Tree Initial Capacity 16 16 ---------
HashMap LinkedHashMap TreeMap Hashtable
Ordered Unordered Ordered by Insertion Sorted Order Unordered Duplicates Key Not Allowed Not Allowed Not Allowed Not Allowed Values Allowed Allowed Allowed Allowed Null Value Allowed Allowed Allowed Not Allowed Synchronized Not Synchronized Not Synchronized Not Synchronized Synchronized Data Structure Hashtable Hashtable + Double Red-Black Tree Hashtable Linked List Initial Capacity 16 16 ------- 11
Iterator ListIterator Enumeration
Applicable to Classes Classes Implementing List Legacy Classes Implementing Interface Collection Interface Accessibility Forward direction Forward and backward Forward direction direction Operations Performed Accessing Removing Accessing, Removing , Accessing Replacing , Adding Method to Access Iterator() listIterator() Elements() Number of methods 3 9 2 Collections Key Points