Java Collections

Java Collections

Java Enumeration, Iterator, ListIterator and Spliterator

In Java, all types of enumerations and iterators (such as Iterator, ListIterator, SplitIterator) are simply navigational cursors and the main purpose of these cursors is to iterate over the elements of the collection. Each cursor has its own features, advantages and disadvantages. In this article, we will walk through these iterators, important methods, advantages, and …

Java 21 Sequenced Collections

The new sequenced collection interfaces allow adding, retrieving, and removing elements at either end of the collection, along with a reverse-ordered view of it.

Java ConcurrentSkipListMap

Learn the Java ConcurrentSkipListMap and the major differences between ConcurrentSkipListMap and other Map implementations.

Java ArrayDeque with Examples

Learn about Java ArrayDeque and its features with practical examples. Learn to use it as Stack and Queue, and the difference from LinkedList.

Java SynchronousQueue with Example

Java SynchronousQueue is a specific type of BlockingQueue with no internal capacity and is primarily used in exchanging data between two threads.

Intoduction to Java Collections

A collection is a group of objects. Java Collections framework consists of classes and interfaces to work with lists, sets, maps and queues.

Java Collection Tutorials

This Java guide will take us through Java Collections framework. We will understand the core concepts and performing the basic operations.

Get SubMap From Map In Java

A submap is a portion or part of a map between the keys of a specific range. Learn how to get submap from map in Java with different ways.

Java Nested Map with Examples

A nested Map is Map inside another Map. Learn to create a nested HashMap and add, remove and iterate over the elements with examples.

Guide to Java IdentityHashMap

IdentityHashMap implements the Map interface and has almost the same features as HashMap. It uses reference equality on key search operations.

Guide to Java ConcurrentMap

ConcurrentMap is an interface in Java Collections and used to create a thread-safe Maps. It stores the key-value pairs in a synchronized way.

Java CopyOnWriteArraySet class

CopyOnWriteArraySet is a thread-safe Set in Java. It ensures safe concurrent access by creating a new copy of the internal array for each modification.

Java CopyOnWriteArrayList class

Java CopyOnWriteArrayList is a thread-safe variant of ArrayList in which all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array. It’s immutable snapshot style iterator method uses a reference to the state of the array at the point that the iterator …

Java TransferQueue Vs. LinkedTransferQueue

In Java, the TransferQueue interface is a concurrent BlockingQueue implementation with support to support “synchronous message passing” between producers and consumers. The key feature of TransferQueue is the transfer() method that blocks until the message is handed off to a consumer. 1. TransferQueue Interface The TransferQueue is an interface in …

Java ArrayBlockingQueue class

ArrayBlockingQueue class is Java concurrent and bounded blocking queue implementation backed by an array. It orders elements FIFO (first-in-first-out). The head of the ArrayBlockingQueue is that element that has been on the queue the longest time. The tail of the ArrayBlockingQueue is that element that has been on the queue …

Java PriorityBlockingQueue class

Java PriorityBlockingQueue class is concurrent blocking queue data structure implementation in which objects are processed based on their priority. The “blocking” part of the name is added to imply the thread will block waiting until there’s an item available on the queue.

Java Spliterator (with Examples)

Unlike traditional iterators, Spliterator is designed with parallelism in mind and mainly helps in parallel processing when the collection or stream has a large number of elements.

Java TreeMap class

Java TreeMap class stores key-value pairs very similar to the HashMap class. The difference is that TreeMap provides an efficient way to store key/value pairs in sorted order. The TreeMap class is a red-black tree-based NavigableMap implementation. This Java TreeMap tutorial will teach us about TreeMap class, methods, usecases, and …

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.