Tagged articles
4 articles
Page 1 of 1
Sohu Smart Platform Tech Team
Sohu Smart Platform Tech Team
Feb 11, 2026 · Backend Development

Why TreeSet Throws ConcurrentModificationException and How to Fix It

An in‑depth look at why Java’s TreeSet can trigger ConcurrentModificationException under high concurrency, exploring the red‑black tree’s non‑atomic operations, thread scheduling nuances, and how various concurrent set implementations—synchronized wrappers, read‑write locks, ConcurrentSkipListSet, CopyOnWriteArraySet, and custom designs—compare in performance and suitability.

CollectionsConcurrentModificationExceptionJava
0 likes · 16 min read
Why TreeSet Throws ConcurrentModificationException and How to Fix It
Programmer DD
Programmer DD
Apr 19, 2019 · Fundamentals

Master Java’s Comparator: Sorting Collections, Streams, and Sets Made Easy

This article explains Java's Comparator interface, its compare method, lambda definitions, and how to use it with Collections.sort, List.sort, Arrays.sort, Stream.sorted, as well as with SortedSet and SortedMap structures, covering static and default methods like reversed, nullsFirst, thenComparing, and more.

ComparatorJavaLambda
0 likes · 31 min read
Master Java’s Comparator: Sorting Collections, Streams, and Sets Made Easy