Below is the list of Standard Data Structures provided in the Java Programming Langauge.
Array:
Array data structure is a fixed-size collection of elements of the same data type that can be accessed using index values. Arrays are efficient for accessing elements by index but inefficient for inserting or deleting elements in the middle of the array.
- Hierarchy: N/A
- Access Time (worst case): O(1)
- Search Time (worst case): O(n)
- Insertion Time (worst case): O(n)
- Deletion Time (worst case): O(n)
- Thread-safety: Not thread-safe
ArrayList:
ArrayList Data Structure is a dynamic array in Java that can grow or shrink during runtime.
- Hierarchy: List
- Access Time (worst case): O(1)
- Search Time (worst case): O(n)
- Insertion Time (worst case): O(n)
- Deletion Time (worst case): O(n)
- Thread-safety: Not thread-safe
LinkedList:
LinkedList is a data structure that stores a collection of elements, where each element has a reference to the next element in the list.
- Hierarchy: List
- Access Time (worst case): O(n)
- Search Time (worst case): O(n)
- Insertion Time (worst case): O(1)
- Deletion Time (worst case): O(1)
- Thread-safety: Not thread-safe
Stack:
Stack is a last-in, first-out (LIFO) data structure that allows elements to be pushed onto and popped off of the top of the stack.
- Hierarchy: List
- Access Time (worst case): O(n)
- Search Time (worst case): O(n)
- Insertion Time (worst case): O(1)
- Deletion Time (worst case): O(1)
- Thread-safety: Not thread-safe
Queue:
A queue is a linear data structure, based on FIFO (First In First Out) principle, elements are inserted from one end called the rear, and removed from the other end called the front.
- Hierarchy: List
- Access Time (worst case): O(n)
- Search Time (worst case): O(n)
- Insertion Time (worst case): O(1)
- Deletion Time (worst case): O(1)
- Thread-safety: Not thread-safe
PriorityQueue:
PriorityQueue is a data structure that orders elements based on their priority, which is determined by a Comparator or the natural ordering of elements.
- Hierarchy: Queue
- Access Time (worst case): O(n)
- Search Time (worst case): O(n)
- Insertion Time (worst case): O(log n)
- Thread-safety: Not thread-safe
Set:
Set data structure is a collection of unique elements that does not allow duplicate values.
- Hierarchy: N/A
- Access Time (worst case): N/A
- Search Time (worst case): O(log n)
- Insertion Time (worst case): O(log n)
- Deletion Time (worst case): O(log n)
- Thread-safety: Not thread-safe
HashSet:
HashSet is a very popular data structure in which the elements are stored using a hash table.
- Hierarchy: Set
- Access Time (worst case): O(1)
- Search Time (worst case): O(1)
- Insertion Time (worst case): O(1)
- Deletion Time (worst case): O(1)
- Thread-safety: Not thread-safe
TreeSet:
TreeSet is an ordered, sorted collection of data based mostly on the red-black tree data structure to maintain the elements in sorted order.
- Hierarchy: Set
- Access Time (worst case): O(log n)
- Search Time (worst case): O(log n)
- Insertion Time (worst case): O(log n)
- Deletion Time (worst case): O(log n)
- Thread-safety: Not thread-safe
Some more Data Structures from Java Collections Framework (up to Java 17)
EnumSet
ArrayDeque
ConcurrentHashMap
CopyOnWriteArrayList
CopyOnWriteArraySet
DelayQueue
EnumMap
IdentityHashMap
LinkedHashMap
LinkedBlockingDeque
LinkedBlockingQueue
PriorityBlockingQueue
TreeMap
WeakHashMap
ConcurrentSkipListSet
ConcurrentSkipListMap
ArrayBlockingQueue
BitSet
Facing issues? Have Questions? Post them here! I am happy to answer!
- Deep Dive into Java 8 Predicate Interface
- Read and Parse XML file using Java DOM Parser [Java Tutorial]
- Java 8 Predicate Functional Interface isEqual() Method Example
- Convert Multidimensional Array toString In Java
- How to read int value using Scanner Class Java
- Spring Boot AI + LLM + Java Code Example
- Write to a File using Java Stream API
- Implementing Bubble Sort Algorithm using Java Program
- How to Fix XmlBeanDefinitionStoreException in Java SpringBoot ApplicationConfig.xml
- YAML Parser using Java Jackson Library Example
- [Fix] java: integer number too large compilation error
- Convert JSON String to Java GSON Object Example
- Read a file using Java 8 Stream
- Java Spring Boot 3 Web Hello World with Gradle in IntelliJ
- Ways Compare Dates in Java Programming with Examples
- Pretty Print JSON String in Java Console Output
- Java JDBC with Join Queries Example
- How to Check For Updates on Windows 11 (Step-by-Step)
- [Fix] java.net.MalformedURLException: unknown protocol
- How to display date and time in GMT Timezone in Java
- Error: LinkageError occurred while loading main class UnsupportedClassVersionError [Eclipse Java]
- How to convert a String to Java 8 Stream of Char?
- RabbitMQ Queue Listener Java Spring Boot Code Example
- 5+ Fibonacci number Series Java Program Examples [ 0 1 1 2 3 ..]
- Handling NullPointerException with Java Predicate
- Create a large dummy file using Mac OS X terminal command - Mac-OS-X
- Maven Eclipse (M2e) No archetypes currently available - Java
- How to do calculations in Mac Terminal - MacOS
- Fix [Fatal Error] :2:6: The processing instruction target matching [xX][mM][lL] is not allowed. - Java
- How to undo last Git Commit on Local Repository? - Git
- How to read int value using Scanner Class Java - Java
- How to install xz data compression software using Brew - HowTos
- Android Studio: Cannot perform refactoring operation - Android-Studio