List
, Set
, Queue
, Map
etc.
ArrayList
, HashSet
, HashMap
etc.
Collections
class.
Collection
β Represents a group of objects, like List, Set, or Queue.
Map
β Represents a collection of key-value pairs.
Map
does not extend Collection
.
Vector
, Stack
, Hashtable
,
Properties
, and Dictionary
are considered legacy classes
but are still part of the framework for backward compatibility.
java.util.Collection
package
java.util.Map
package
ArrayList
or LinkedList
to store lists of students, products, or items.Queue
or Deque
for tasks like managing print jobs or task scheduling.HashSet
or TreeSet
to store unique elements like employee IDs.HashMap
or TreeMap
to store data in key-value pairs like country-capital mapping.ArrayList
, HashMap
, etc., without writing code from scratch.List
, Set
, Map
for various needs.Vector
and Hashtable
are synchronized and safe for multithreaded use.
Your feedback helps us grow! If there's anything we can fix or improve, please let us know.
Weβre here to make our tutorials better based on your thoughts and suggestions.