0% found this document useful (0 votes)
3 views

Java_Collections_Table

The document provides a comparison of various Java collection types, detailing their characteristics such as whether they are ordered, allow duplicates, allow null values, and their thread-safety. It includes collections like ArrayList, LinkedList, HashSet, and HashMap, among others, along with their use cases. Each collection type is categorized by its interface and specific properties to guide usage in programming scenarios.

Uploaded by

otppurpose99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Java_Collections_Table

The document provides a comparison of various Java collection types, detailing their characteristics such as whether they are ordered, allow duplicates, allow null values, and their thread-safety. It includes collections like ArrayList, LinkedList, HashSet, and HashMap, among others, along with their use cases. Each collection type is categorized by its interface and specific properties to guide usage in programming scenarios.

Uploaded by

otppurpose99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Collection TypeImplements/Extends Ordered? Allows Duplicates? Allows Null? Thread-Safe?

Use Case

ArrayList List Yes (Insertion Order) Yes Yes (One Null) When
No you need a dynamic arra

LinkedList List, Deque Yes (Insertion Order) Yes Yes No


Fast insertions/deletions; use

Vector List Yes (Insertion Order) Yes Yes YesLegacy thread-safe dynamic

Stack Vector Yes (LIFO) Yes Yes Yes


When you need LIFO (Last In F

HashSet Set No No Yes (One Null) No


To store unique elements with

LinkedHashSet HashSet Yes (Insertion Order) No Yes (One Null) When


No you need uniqueness and

TreeSet NavigableSet (SortedSet)


Yes (Sorted Order) No No (Throws NPE) No
Sorted unique elements (natur

HashMap Map No Keys: No, Keys:


Values:
One
YesNull, Values: Multiple Nu...
NoFast lookup using key-value

LinkedHashMap HashMap Yes (Insertion Order)


Keys: No, Keys:
Values:
One
YesNull, Values: Multiple Nu...
NoMaintains order of insertion fo

TreeMapNavigableMap (SortedMap)
Yes (Sorted by Key)
Keys: No, Values: Yes No (for keys) No Sorted key-value pairs

Hashtable Map No Keys: No, Values: Yes No Yes Legacy thread-safe map

ConcurrentHashMap Map No Keys: No, Values: Yes No Yes


Thread-safe map for concurren

PriorityQueue Queue Yes (Priority Order) Yes No No


Elements are ordered based on

You might also like