Tagged articles
JDK7
14 articles · Page 1 of 1
This article thoroughly examines Java's ConcurrentHashMap by tracing its evolution from JDK 1.5's segment‑lock design to JDK 8's CAS‑plus‑synchronized implementation, detailing internal structures, put/get algorithms, resizing mechanics, performance trade‑offs, and common interview questions.
ConcurrencyConcurrentHashMapJDK7
0 likes · 12 min read

This article provides a comprehensive, step‑by‑step analysis of Java's ConcurrentHashMap, covering its evolution from JDK 7’s segment‑lock design to JDK 8’s bucket‑level CAS and synchronized approach, complete with macro diagrams, microscopic source‑code walkthroughs, hash calculations, resizing mechanisms, and practical usage tips.
ConcurrencyConcurrentHashMapHashMap
0 likes · 16 min read

This guide explains Java's try-with-resources statement introduced in JDK 7, showing how it automatically closes AutoCloseable resources, eliminates boilerplate finally blocks, manages closure order and suppressed exceptions, avoids common decorator pitfalls, and provides best‑practice examples for robust production code.
AutoCloseableException HandlingJDK7
0 likes · 10 min read

This article explains the shortcomings of HashMap, compares Hashtable, synchronizedMap, and ConcurrentHashMap implementations in JDK 7 and JDK 8, discusses lock states, fail‑fast vs fail‑safe behavior, and provides code examples and optimization tips for thread‑safe map operations.
ConcurrentHashMapJDK7JDK8
0 likes · 12 min read

This article explains why the pre‑JDK 1.8 HashMap can enter an infinite loop during concurrent resizing, illustrates the problem with detailed step‑by‑step diagrams, and shows how JDK 1.8 redesigns the resize algorithm to prevent the loop.
ConcurrencyDeadLoopHashMap
0 likes · 5 min read

Java developers often close resources manually using try-catch-finally, but since JDK 7 the try‑with‑resources construct automates this process; this article explains the traditional pattern, demonstrates the new syntax, shows how to implement custom Closeable classes, and reveals the compiler‑generated bytecode that preserves original exceptions via addSuppressed.
CloseableException HandlingJDK7
0 likes · 10 min read

This article explains why Java's HashMap is unsafe in multithreaded environments, detailing how JDK 1.7's resize operation can create circular linked lists and data loss, and how JDK 1.8's tail‑insertion still suffers from element overwriting under concurrent puts.
ConcurrencyHashMapJDK7
0 likes · 10 min read

This article explains how ConcurrentHashMap ensures thread safety in Java, comparing the lock‑segmentation design of JDK 7 with the CAS‑based, bucket‑level synchronization of JDK 8, and includes key source code excerpts illustrating the insertion process.
CASConcurrencyConcurrentHashMap
0 likes · 11 min read

This article explains why ConcurrentHashMap provides thread‑safe and high‑performance map operations, compares it with HashMap and Hashtable, and details the architectural changes from JDK 1.7’s segment‑lock design to JDK 1.8’s array‑list‑red‑black‑tree and CAS‑based implementation.
ConcurrentHashMapJDK7JDK8
0 likes · 7 min read

This article explains why Java's HashMap is not thread‑safe, analyzing the dead‑loop and data‑loss problems caused by resizing in JDK 7 and the overwrite issue in JDK 8, with code examples and step‑by‑step thread interleaving illustrations.
ConcurrencyHashMapJDK7
0 likes · 11 min read

This article explains the fundamentals of hash tables, dives deep into Java's HashMap implementation—including JDK7 source code analysis of its internal structures, resizing logic, and key methods—while also covering common interview questions such as why the array size must be a power of two and the necessity of overriding both equals and hashCode.
HashMapInterviewJDK7
0 likes · 19 min read

This article explains the thread‑safety problems of Java's HashMap in JDK 1.7 and JDK 1.8, showing how concurrent resize operations can create circular linked lists, cause infinite loops or data loss, and why the underlying implementation remains unsafe despite JDK 1.8's optimizations.
ConcurrencyHashMapJDK7
0 likes · 9 min read

This article demonstrates how to leverage JDK7's standard library—Path, Paths, Files, and FileSystem—to perform flexible file operations, safe path concatenation, size‑checked reading, automatic resource management, directory traversal with FileVisitor, and security measures for preventing unsafe file access.
BackendFile I/OJDK7
0 likes · 7 min read

This article explains how the original JDK 6 implementation of String.substring could retain large character arrays and cause apparent memory‑leak‑like OutOfMemoryError, describes the underlying fields, reproduces the issue, and shows how JDK 7’s copy‑on‑substring redesign resolves the problem.
JDK6JDK7Java
0 likes · 10 min read
