Java Concurrent Collections

Su Suriya Ravichandran Updated 18 Nov 2026
14 min read ·Lesson 198 of 306

Java concurrent collections are thread-safe lists, sets, maps and queues from the java.util.concurrent package. Several threads can read and change them at the same time without corrupting data and without you writing synchronized blocks.

Regular collections such as ArrayList and HashMap are fast but not thread-safe. This lesson shows what goes wrong with them under concurrency and how ConcurrentHashMap, CopyOnWriteArrayList, ConcurrentLinkedQueue, BlockingQueue and ConcurrentSkipListMap solve the problem.


Why Regular Collections Fail with Multiple Threads

ArrayList.add() reads the current size, stores the element, and then increases the size. When two threads do this at the same moment, one write can overwrite the other, the same kind of race condition you saw with counter++ in Java Threads.

import java.util.ArrayList;
import java.util.List;

public class UnsafeListDemo {
    public static void main(String[] args) throws InterruptedException {
        List<Integer> numbers = new ArrayList<>(); // NOT thread-safe

        Runnable addTenThousand = () -> {
            for (int i = 0; i < 10_000; i++) {
                numbers.add(i);
            }
        };

        Thread first = new Thread(addTenThousand);
        Thread second = new Thread(addTenThousand);
        first.start();
        second.start();
        first.join();
        second.join();

        System.out.println("Expected size: 20000");
        System.out.println("Actual size  : " + numbers.size());
    }
}

Output from one run (it changes every time, and the program can also crash with ArrayIndexOutOfBoundsException):

Expected size: 20000
Actual size  : 13587

How it works:

  • Both threads call add() on the same ArrayList at the same time.
  • Their internal steps interleave, so some elements overwrite each other and are lost.
  • If one thread grows the internal array while the other writes to it, add() can even throw an exception.

Note: A bug like this may not show up on your laptop and then appear in production under heavy load. Never share a plain ArrayList, HashMap or HashSet between threads that modify it.


Synchronized Wrappers vs Concurrent Collections

Java offers two ways to make collections thread-safe:

Synchronized wrapperConcurrent collection
ExampleCollections.synchronizedList(new ArrayList<>())CopyOnWriteArrayList, ConcurrentHashMap
LockingOne lock for the whole collectionFine-grained locks, CAS operations or copy-on-write
Many threads at onceThreads wait for each otherThreads mostly work in parallel
Iterating while others modifyMust lock manually, otherwise ConcurrentModificationExceptionSafe, never throws ConcurrentModificationException
Atomic compound actionsNot availableputIfAbsent, merge, compute, ...
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class SynchronizedWrapperDemo {
    public static void main(String[] args) throws InterruptedException {
        List<Integer> numbers = Collections.synchronizedList(new ArrayList<>());

        Runnable addTenThousand = () -> {
            for (int i = 0; i < 10_000; i++) {
                numbers.add(i);
            }
        };

        Thread first = new Thread(addTenThousand);
        Thread second = new Thread(addTenThousand);
        first.start();
        second.start();
        first.join();
        second.join();

        System.out.println("Size: " + numbers.size());

        // Iteration is NOT protected automatically: lock the list yourself
        long evenCount;
        synchronized (numbers) {
            evenCount = numbers.stream().filter(n -> n % 2 == 0).count();
        }
        System.out.println("Even numbers: " + evenCount);
    }
}

Output:

Size: 20000
Even numbers: 10000

How it works:

  • Every method of the wrapper locks the list, so add() calls no longer lose elements.
  • Iterating (including streams) is several calls in a row, so the wrapper cannot protect it. The synchronized (numbers) block does that job.
  • Concurrent collections remove both problems: they scale better and are safe to iterate without extra locks.

ConcurrentHashMap in Java

ConcurrentHashMap is the thread-safe replacement for HashMap. Reads never block, and writes lock only a small part of the map, so many threads can use it at once. It also offers atomic compound methods that read and update a value as one step.

MethodWhat it does atomically
putIfAbsent(key, value)Adds the entry only if the key is missing
computeIfAbsent(key, fn)Creates the value with fn only if the key is missing
compute(key, fn)Replaces the value with fn(key, oldValue)
merge(key, value, fn)Inserts value, or combines it with the old value using fn
getOrDefault(key, default)Reads a value with a fallback

Counting Words with merge()

import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class WordCountDemo {
    public static void main(String[] args) {
        List<String> reviews = List.of(
                "java is fast", "java is fun", "threads are fast",
                "java threads are fun", "fun fun fun");

        Map<String, Integer> wordCounts = new ConcurrentHashMap<>();

        try (ExecutorService executor = Executors.newFixedThreadPool(4)) {
            for (String review : reviews) {
                executor.submit(() -> {
                    for (String word : review.split(" ")) {
                        wordCounts.merge(word, 1, Integer::sum); // atomic "add one"
                    }
                });
            }
        } // close() waits for every task

        System.out.println(new TreeMap<>(wordCounts)); // sorted for readable output
    }
}

Output:

{are=2, fast=2, fun=5, is=2, java=3, threads=2}

How it works:

  • Four pool threads process the reviews at the same time and update the same map.
  • merge(word, 1, Integer::sum) puts 1 for a new word, or adds 1 to the old count, as a single atomic step. No update is lost.
  • Copying into a TreeMap only sorts the keys for printing.

Note: map.put(word, map.get(word) + 1) is not safe even on a ConcurrentHashMap, because another thread can change the value between get() and put(). Use merge() or compute() instead.

computeIfAbsent, compute and Null Values

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class ConcurrentHashMapMethods {
    public static void main(String[] args) {
        Map<String, List<String>> studentsByCourse = new ConcurrentHashMap<>();

        // computeIfAbsent creates the list only the first time
        studentsByCourse.computeIfAbsent("Java", course -> new ArrayList<>()).add("Asha");
        studentsByCourse.computeIfAbsent("Java", course -> new ArrayList<>()).add("Ravi");
        studentsByCourse.computeIfAbsent("Python", course -> new ArrayList<>()).add("Meena");
        System.out.println(studentsByCourse);

        Map<String, Integer> seats = new ConcurrentHashMap<>(Map.of("Java", 30, "Python", 25));

        // compute: take one seat, but never go below zero
        seats.compute("Java", (course, left) -> left > 0 ? left - 1 : 0);
        System.out.println("Java seats left: " + seats.get("Java"));

        System.out.println("Go seats: " + seats.getOrDefault("Go", 0));

        try {
            seats.put("Rust", null);
        } catch (NullPointerException e) {
            System.out.println("ConcurrentHashMap does not allow null keys or values");
        }
    }
}

Output (the order of map entries can differ):

{Java=[Asha, Ravi], Python=[Meena]}
Java seats left: 29
Go seats: 0
ConcurrentHashMap does not allow null keys or values

How it works:

  • computeIfAbsent() creates the ArrayList for "Java" once. The second call finds it and returns the existing list.
  • compute() reads the old value and writes the new one in one atomic step.
  • ConcurrentHashMap rejects null keys and values, because get() returning null must clearly mean "no such key".

Note: The lists stored inside the map are plain ArrayLists. If several threads add students to the same course, make the inner lists thread-safe too, for example with CopyOnWriteArrayList.


CopyOnWriteArrayList in Java

CopyOnWriteArrayList makes a fresh copy of its internal array on every write. Readers always work on a stable snapshot, so iterating is fast, needs no lock, and never throws ConcurrentModificationException. The trade-off is that writes are expensive, so use it for lists that are read often and changed rarely, such as listener lists or configuration.

import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

public class CopyOnWriteDemo {
    public static void main(String[] args) {
        // 1. A normal ArrayList fails if it is modified during iteration
        List<String> plainList = new ArrayList<>(List.of("email", "sms"));
        try {
            for (String channel : plainList) {
                if (channel.equals("email")) {
                    plainList.add("push");
                }
            }
        } catch (ConcurrentModificationException e) {
            System.out.println("ArrayList: ConcurrentModificationException");
        }

        // 2. CopyOnWriteArrayList iterates over a snapshot
        List<String> safeList = new CopyOnWriteArrayList<>(List.of("email", "sms"));
        for (String channel : safeList) {
            System.out.println("notifying via " + channel);
            if (channel.equals("email")) {
                safeList.add("push"); // goes into a new copy, not the one being iterated
            }
        }
        System.out.println("List after loop: " + safeList);
    }
}

Output:

ArrayList: ConcurrentModificationException
notifying via email
notifying via sms
List after loop: [email, sms, push]

How it works:

  • Changing an ArrayList while a for-each loop walks over it makes the iterator fail.
  • The CopyOnWriteArrayList iterator walks the snapshot taken when the loop started, so "push" is not visited in this loop.
  • After the loop, the list contains all three channels. CopyOnWriteArraySet offers the same behaviour for sets.

ConcurrentLinkedQueue: A Non-Blocking Queue

ConcurrentLinkedQueue is an unbounded, thread-safe FIFO queue that uses lock-free compare-and-swap operations. offer() adds at the tail, and poll() removes from the head or returns null immediately if the queue is empty. It never makes a thread wait.

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;

public class ConcurrentQueueDemo {
    public static void main(String[] args) {
        Queue<String> printJobs = new ConcurrentLinkedQueue<>();
        for (int job = 1; job <= 9; job++) {
            printJobs.offer("job-" + job);
        }

        AtomicInteger printed = new AtomicInteger();

        try (ExecutorService printers = Executors.newFixedThreadPool(3)) {
            for (int p = 0; p < 3; p++) {
                printers.submit(() -> {
                    String job;
                    while ((job = printJobs.poll()) != null) { // null means: queue empty
                        printed.incrementAndGet();
                    }
                });
            }
        }

        System.out.println("Jobs printed : " + printed.get());
        System.out.println("Queue empty? : " + printJobs.isEmpty());
    }
}

Output:

Jobs printed : 9
Queue empty? : true

How it works:

  • Three printer threads take jobs from the same queue at the same time.
  • poll() is atomic, so each job is taken by exactly one printer; none is printed twice or lost.
  • When the queue is empty, poll() returns null and each printer loop ends. The counter is an AtomicInteger, covered in Java Atomic Classes.

BlockingQueue: Producer-Consumer in Java

A BlockingQueue adds waiting operations. put() waits while a bounded queue is full, and take() waits while the queue is empty. This makes it the standard tool for the producer-consumer pattern, where some threads create work and others process it.

OperationThrows exceptionReturns special valueBlocksTimes out
Insertadd(e)offer(e) → falseput(e)offer(e, time, unit)
Removeremove()poll() → nulltake()poll(time, unit)
Examineelement()peek() → null––

Common implementations are ArrayBlockingQueue (bounded, array-based), LinkedBlockingQueue (optionally bounded), PriorityBlockingQueue (ordered by priority) and DelayQueue (elements become available after a delay).

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class ProducerConsumerDemo {
    private static final String POISON_PILL = "DONE"; // tells the consumer to stop

    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> orders = new ArrayBlockingQueue<>(2); // holds at most 2 orders

        Thread kitchen = new Thread(() -> {
            try {
                while (true) {
                    String order = orders.take(); // waits while the queue is empty
                    if (order.equals(POISON_PILL)) {
                        break;
                    }
                    Thread.sleep(100);            // cooking takes time
                    System.out.println("Kitchen cooked " + order);
                }
                System.out.println("Kitchen closed");
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
        }, "kitchen");
        kitchen.start();

        String[] menu = {"Dosa", "Idli", "Pongal", "Vada"};
        for (String dish : menu) {
            orders.put(dish); // waits while the queue is full
            System.out.println("Waiter queued " + dish + " (queue size " + orders.size() + ")");
        }
        orders.put(POISON_PILL);
        kitchen.join();
    }
}

Output from one run:

Waiter queued Dosa (queue size 1)
Waiter queued Idli (queue size 1)
Waiter queued Pongal (queue size 2)
Kitchen cooked Dosa
Waiter queued Vada (queue size 2)
Kitchen cooked Idli
Kitchen cooked Pongal
Kitchen cooked Vada
Kitchen closed

How it works:

  • The waiter (main thread) is the producer; the kitchen thread is the consumer.
  • The queue holds only two orders. When it is full, put() makes the waiter wait until the kitchen takes an order, so a fast producer cannot overwhelm a slow consumer.
  • take() makes the kitchen wait when there is nothing to cook, without wasting CPU in a loop.
  • The special "DONE" order, a poison pill, tells the consumer to stop cleanly.

ConcurrentSkipListMap: A Sorted Concurrent Map

ConcurrentSkipListMap is the concurrent version of TreeMap: its keys stay sorted, and it supports navigation methods such as firstKey(), headMap() and descendingMap(). ConcurrentSkipListSet is the matching sorted set.

import java.util.concurrent.ConcurrentSkipListMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class SkipListLeaderboard {
    public static void main(String[] args) {
        // score -> player, highest score first
        ConcurrentSkipListMap<Integer, String> leaderboard =
                new ConcurrentSkipListMap<>((a, b) -> Integer.compare(b, a));

        String[] players = {"Arun", "Bala", "Chitra", "Divya", "Elan"};
        int[] scores = {870, 1240, 990, 1510, 640};

        try (ExecutorService gameServers = Executors.newFixedThreadPool(3)) {
            for (int i = 0; i < players.length; i++) {
                int index = i;
                gameServers.submit(() -> leaderboard.put(scores[index], players[index]));
            }
        }

        System.out.println("Leaderboard : " + leaderboard);
        System.out.println("Top player  : " + leaderboard.firstEntry().getValue());
        System.out.println("Score >= 990: " + leaderboard.headMap(990, true).values());
    }
}

Output:

Leaderboard : {1510=Divya, 1240=Bala, 990=Chitra, 870=Arun, 640=Elan}
Top player  : Divya
Score >= 990: [Divya, Bala, Chitra]

How it works:

  • Three game-server threads insert scores at the same time, and the map keeps them sorted.
  • The comparator Integer.compare(b, a) reverses the order, so the highest score comes first.
  • headMap(990, true) returns every entry up to and including 990 in the map's order, which here means all scores of 990 or more.

Choosing Between Java Concurrent Collections

NeedUse
Thread-safe map, many readers and writersConcurrentHashMap
Sorted thread-safe map or setConcurrentSkipListMap, ConcurrentSkipListSet
List read often, changed rarelyCopyOnWriteArrayList
Set read often, changed rarelyCopyOnWriteArraySet
Non-blocking FIFO queueConcurrentLinkedQueue, ConcurrentLinkedDeque
Producer-consumer with waitingArrayBlockingQueue, LinkedBlockingQueue
Tasks ordered by priorityPriorityBlockingQueue
Thread-safe set backed by a mapConcurrentHashMap.newKeySet()
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ConcurrentSetDemo {
    public static void main(String[] args) {
        Set<String> visitedPages = ConcurrentHashMap.newKeySet();
        String[] clicks = {"/home", "/java", "/home", "/python", "/java", "/home"};

        try (ExecutorService executor = Executors.newFixedThreadPool(3)) {
            for (String page : clicks) {
                executor.submit(() -> visitedPages.add(page));
            }
        }
        System.out.println("Unique pages: " + visitedPages.size());
    }
}

Output:

Unique pages: 3

How it works:

  • ConcurrentHashMap.newKeySet() returns a Set backed by a ConcurrentHashMap, so add() is thread-safe.
  • Duplicate clicks from different threads are stored only once, leaving three unique pages.

Real-World Example: A Multithreaded Log Analyzer

A web server writes access-log lines. Two reader threads (producers) feed lines into a bounded queue, three analyzer threads (consumers) parse them, and the results go into a shared ConcurrentHashMap. A CopyOnWriteArrayList collects slow requests for an alert report.

import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;

public class LogAnalyzer {
    private static final String END = "<END>";
    private static final int ANALYZERS = 3;

    public static void main(String[] args) throws InterruptedException {
        // Two log files, each line: method path status durationMs
        List<String> serverA = List.of(
                "GET /home 200 35", "GET /java 200 48", "POST /login 401 12",
                "GET /api/courses 500 950", "GET /home 200 30");
        List<String> serverB = List.of(
                "GET /java 200 52", "GET /missing 404 5", "GET /api/courses 200 1200",
                "POST /login 200 80", "GET /home 200 41");

        BlockingQueue<String> lines = new LinkedBlockingQueue<>(4); // bounded buffer
        Map<String, Integer> statusCounts = new ConcurrentHashMap<>();
        Map<String, Integer> hitsPerPath = new ConcurrentHashMap<>();
        List<String> slowRequests = new CopyOnWriteArrayList<>();

        try (ExecutorService pool = Executors.newFixedThreadPool(5)) {
            // Consumers: parse lines until they receive the END marker
            for (int a = 0; a < ANALYZERS; a++) {
                pool.submit(() -> {
                    while (true) {
                        String line = lines.take();
                        if (line.equals(END)) {
                            return null;
                        }
                        String[] parts = line.split(" ");
                        String path = parts[1];
                        String status = parts[2];
                        int durationMs = Integer.parseInt(parts[3]);

                        statusCounts.merge(status, 1, Integer::sum);
                        hitsPerPath.merge(path, 1, Integer::sum);
                        if (durationMs > 500) {
                            slowRequests.add(path + " took " + durationMs + " ms");
                        }
                    }
                });
            }

            // Producers: read both "files" at the same time
            var readerA = pool.submit(() -> { for (String l : serverA) lines.put(l); return null; });
            var readerB = pool.submit(() -> { for (String l : serverB) lines.put(l); return null; });

            try {
                readerA.get();
                readerB.get();
            } catch (Exception e) {
                throw new IllegalStateException("reader failed", e);
            }
            for (int a = 0; a < ANALYZERS; a++) {
                lines.put(END); // one stop signal per consumer
            }
        }

        System.out.println("Requests by status: " + new TreeMap<>(statusCounts));
        System.out.println("Hits per path     : " + new TreeMap<>(hitsPerPath));
        System.out.println("Slow requests     : " + slowRequests.stream().sorted().toList());
        int total = statusCounts.values().stream().mapToInt(Integer::intValue).sum();
        System.out.println("Total lines       : " + total);
    }
}

Output:

Requests by status: {200=7, 401=1, 404=1, 500=1}
Hits per path     : {/api/courses=2, /home=3, /java=2, /login=2, /missing=1}
Slow requests     : [/api/courses took 1200 ms, /api/courses took 950 ms]
Total lines       : 10

How it works:

  1. Bounded hand-off. LinkedBlockingQueue<>(4) holds at most four lines. Readers wait with put() when analyzers fall behind, which keeps memory use under control.
  2. Parallel parsing. Three analyzers call take() on the same queue. Each line is delivered to exactly one of them.
  3. Lock-free counting. merge(key, 1, Integer::sum) on two ConcurrentHashMaps updates counters from all three analyzers without lost updates.
  4. Rarely-written list. Only slow requests are added to the CopyOnWriteArrayList, so the copy-on-write cost stays low while reading it is free.
  5. Clean shutdown. After both readers finish, the main thread puts one END marker per analyzer, so every consumer stops. Closing the pool then waits for them.
  6. Deterministic report. The threads finish in a random order, but sorting with TreeMap and sorted() makes the printed report identical on every run.

The analyzers above are Callable tasks (they return null), because take() throws a checked InterruptedException. See Java Callable Interface for why that matters, and Java Atomic Classes for thread-safe single counters.

0 Comments

Reviewed before they appear

No comments yet.

Java
Java Introduction Java Features Java Syntax Java Comments Java Statements Java Output Java Variables Java Data Types Java Type Casting Java Operators Java Strings Java Numbers Java Math Java Booleans Java User Input Java Conditions Java If Else Java Switch Java While Loop Java For Loop Java Break Java Continue Java Arrays Java Methods Java Parameters Java Return Values Java Scope Java Recursion Install Java Install JDK Java IDEs Java JDK Java JRE Java JVM Java Compiler Java File Compile Java Run Java JShell Basics Java Packages Java OOP Java Classes Java Objects Class Methods Constructors Constructor Overload this Keyword static Keyword final Keyword Encapsulation Inheritance Polymorphism Abstraction Access Modifiers super Keyword Method Overload Method Override Instanceof Operator Nested Classes Inner Classes Anonymous Classes Enums Records Array Basics Array Length Loop Arrays Multidimensional Arrays Array Copy Array Sorting Array Search ArrayList LinkedList HashSet TreeSet HashMap TreeMap Queue Interface Deque Interface Stack Class Iterator List Interface Set Interface Map Interface Collections Class Comparable Comparator Generics Basics Generic Classes Generic Methods Wildcards String Basics String Length String Methods String Concatenation String Compare String Search String Replace String Split String Format StringBuilder StringBuffer Text Blocks Regular Expressions Number Types Integer Class Float Class Double Class BigInteger BigDecimal Math Class Random Numbers Number Format Date Basics LocalDate LocalTime LocalDateTime ZonedDateTime Date Formatting Date Parsing Period Class Duration Class Java Instant Class Java Exception Basics Java try...catch Java Multiple Catch Blocks Java finally Block Java throw Keyword Java throws Keyword Java Checked Exceptions Java Unchecked Exceptions Java Custom Exceptions Java try-with-resources Java Exception Chaining Java File Basics Java Create Files Java Read Files Java Write Files Java Delete Files Java File Paths Java File Class Java BufferedReader Java BufferedWriter Java FileInputStream Java FileOutputStream Java Object Streams Java Directory Handling Java NIO Basics Java Files API Java Input Java Scanner Class Java Console Input Java PrintStream Java InputStream Java OutputStream Java Reader Class Java Writer Class Java Buffered Streams Java Data Streams Java Generics Introduction Java Generic Types Java Generic Methods Java Bounded Types Java Wildcards Java Type Erasure Java Generic Interfaces Java Generic Collections Java Lambda Basics Java Lambda Syntax Java Functional Interfaces Java Method References Java Stream API Java Stream Creation Java Stream Filter Java Stream Map Java Stream Reduce Java Stream Sort Java Stream Collect Java Collectors Class Java Optional Class Java Parallel Streams Java Threads: Thread Basics Create a Thread in Java Java Thread Class Java Runnable Interface Java Thread States Java Thread Sleep Java Thread Join Java Thread Priority Java Synchronization Java Thread Safety Java Race Conditions Java Deadlocks Java Executor Service Java Thread Pools Java Callable Interface Java Future Interface Java CompletableFuture Java Concurrent Collections Java Atomic Classes Java Virtual Threads Java Networking Basics Java URL Class Java URI Class Java HttpClient Java HTTP Requests Java HTTP Responses Java Socket Basics Java ServerSocket Java DatagramSocket Java WebSocket Basics Java JDBC Basics Java JDBC Setup Java Database Connection Java JDBC Connection Interface Java JDBC Statement Java PreparedStatement Java ResultSet Java JDBC CRUD Operations Java JDBC Transactions Java JDBC Batch Update Java Connection Pooling with HikariCP Java JPA Basics: Entities, EntityManager and JPQL Java Hibernate Basics: SessionFactory, Session and HQL Package in Java: Basics Explained with Examples Create Package in Java: Step-by-Step Guide with Examples Import Package in Java: The import Statement Explained Access Control in Java: Packages, Classes and Members JAR File in Java: Create, Run and Inspect JAR Files Java Modules: Introduction to the Java Module System module-info in Java: Every Module Directive Explained Java Module Path: How --module-path Finds Your Modules Java Classpath: How -cp and CLASSPATH Find Your Classes Java Annotations: Basics of @ Metadata in Java Java Built-in Annotations: @Override, @Deprecated and More Java Custom Annotations: Create Your Own @interface Java Annotation Targets: @Target and ElementType Explained Java Reflection API: Inspect and Use Classes at Runtime Java Class Metadata: Names, Modifiers, Hierarchy and Generic Java Dynamic Objects: Create Objects Dynamically With Reflec Java Dynamic Proxy: Intercept Method Calls With Proxy and In Java Security Java Secure Coding Java Password Hashing Java Input Validation Java Cryptography Basics Java KeyStore Basics Java TLS Basics Java SecureRandom Java JUnit Basics Java JUnit Test Methods JUnit Assertions JUnit Test Fixtures JUnit Parameterized Tests Mockito in Java Java Mock Objects Java Integration Testing Java Code Coverage Maven in Java Create a Maven Project in Java Maven Dependencies Maven Plugins Gradle in Java Gradle Build Gradle Dependencies Build Executable JAR in Java Build WAR File in Java HTTP Basics in Java Java Servlet Basics Servlet Lifecycle in Java HttpServletRequest in Java HttpServletResponse in Java JSP in Java JSTL in JSP REST API in Java JSON in Java Java Web Application Spring Framework Basics Spring Boot Tutorial Spring MVC Spring Data JPA Spring Security Spring Boot REST API Jakarta EE Basics Java Deployment JAR Deployment Java WAR Deployment Run Java as a Service Docker Java: Dockerize a Java Application Java Environment Variables and Configuration Java Logging Basics Java Production Setup Java JVM Options Java JVM Monitoring Java Hello World App Java Calculator App Java Number Guess Game Java Student Manager Java Library System Java Bank App Java Todo App Java File Manager Java Quiz App Java REST API Project Java Chat Server Java Employee Manager Java E-commerce API
Ask about this post
AI Ask about this post

Ask questions about Java Concurrent Collections and get answers drawn from it.

Signed-in readers only.