Tag

HashMap

0 views collected around this technical thread.

Java Tech Enthusiast
Java Tech Enthusiast
May 15, 2025 · Fundamentals

Detect Squares Problem – Algorithm Design, Hash‑Map Solutions, and Complexity Analysis

The article first highlights Tencent's Q1 2025 financial results and user metrics, then introduces the LeetCode 2013 'Detect Squares' problem, describing its requirements, example, and offering Java, C++, Python, and array‑based solutions along with time and space complexity analysis.

C++DataStructureDetectSquares
0 likes · 9 min read
Detect Squares Problem – Algorithm Design, Hash‑Map Solutions, and Complexity Analysis
Architecture Digest
Architecture Digest
May 13, 2025 · Fundamentals

Understanding HashMap Traversal: keySet vs entrySet and Iterator Mechanics

This article explains the various ways to traverse a Java HashMap, compares keySet and entrySet approaches, shows why keySet involves two passes, and demonstrates the underlying iterator implementation with detailed code examples and decompiled snippets.

HashMapIteratorJava
0 likes · 8 min read
Understanding HashMap Traversal: keySet vs entrySet and Iterator Mechanics
Java Tech Enthusiast
Java Tech Enthusiast
Apr 2, 2025 · Backend Development

Understanding the Underlying Mechanism of Java HashMap

Java’s HashMap stores entries in a hash‑based array where a key’s hash determines the bucket index, resolves collisions with linked lists that become red‑black trees for long chains, resizes when the load factor exceeds 0.75, and requires ConcurrentHashMap for safe multithreaded updates, a core concept often asked in interviews.

Data StructureHashMapInterview
0 likes · 6 min read
Understanding the Underlying Mechanism of Java HashMap
Architecture Digest
Architecture Digest
Mar 18, 2025 · Fundamentals

Understanding Java foreach Loop, HashMap Iteration, and ConcurrentModificationException

This article explains how Java's foreach loop is implemented using iterators, demonstrates the bytecode differences between array and collection traversal, analyzes why modifying a HashMap during foreach can trigger ConcurrentModificationException, and shows the correct way to safely modify collections with an iterator.

ConcurrentModificationExceptionHashMapIterator
0 likes · 11 min read
Understanding Java foreach Loop, HashMap Iteration, and ConcurrentModificationException
macrozheng
macrozheng
Mar 11, 2025 · Backend Development

Boost Java Loop Performance: Replace Nested Loops with Map Lookups

This article demonstrates how to dramatically speed up Java data‑matching operations that use nested for‑loops by breaking early when a match is found and by converting the inner list into a HashMap for O(1) lookups, showing code examples, performance measurements, and practical tips for backend developers.

HashMapJavaPerformance
0 likes · 7 min read
Boost Java Loop Performance: Replace Nested Loops with Map Lookups
Java Tech Enthusiast
Java Tech Enthusiast
Feb 1, 2025 · Backend Development

Optimizing Nested Loops in Java with Map and Break

To avoid the O(n × m) cost of naïve nested loops when matching IDs, replace the inner scan with a break after a unique match or, far more efficiently, build a HashMap of the secondary list so each lookup becomes O(1), dropping overall complexity to O(n + m) and cutting execution time from tens of seconds to a few hundred milliseconds.

HashMapJavaPerformance
0 likes · 8 min read
Optimizing Nested Loops in Java with Map and Break
macrozheng
macrozheng
Dec 16, 2024 · Backend Development

Boost Java Loop Performance: Replace Nested Loops with a HashMap

This article demonstrates how to dramatically speed up Java code that matches items between two large lists by eliminating nested loops, using early‑exit with break and, more effectively, pre‑building a HashMap for O(1) lookups, with concrete timing results and full code examples.

HashMapJavaNested Loops
0 likes · 8 min read
Boost Java Loop Performance: Replace Nested Loops with a HashMap
Java Captain
Java Captain
Nov 19, 2024 · Backend Development

Optimizing Nested Loop Data Matching with a Map in Java

This article demonstrates how replacing a costly nested‑loop search for matching user IDs with a pre‑built HashMap dramatically reduces processing time from tens of seconds to a few seconds, explaining the underlying time‑complexity benefits and providing complete Java code examples.

HashMapJavaPerformance
0 likes · 6 min read
Optimizing Nested Loop Data Matching with a Map in Java
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Sep 17, 2024 · Backend Development

In‑Depth Explanation of Java ConcurrentHashMap Core Principles and Source Code

This article provides a comprehensive analysis of Java's ConcurrentHashMap, covering its underlying data structures, key attributes, core components such as Node, ForwardingNode, TreeBin, and TreeNode, and detailed explanations of the put, get, hash, and resizing algorithms with annotated source code examples.

ConcurrencyConcurrentHashMapHashMap
0 likes · 17 min read
In‑Depth Explanation of Java ConcurrentHashMap Core Principles and Source Code
Architect's Guide
Architect's Guide
Sep 9, 2024 · Fundamentals

Why HashMap.keySet() Traversal Performs Two Iterations and How entrySet() Is More Efficient

This article explains the internal mechanism of Java's HashMap traversal, showing that using keySet() triggers two passes—once to create an iterator and once to fetch values—while entrySet() or Map.forEach() can iterate in a single pass, and it walks through the relevant source code to illustrate the process.

HashMapIterationIterator
0 likes · 9 min read
Why HashMap.keySet() Traversal Performs Two Iterations and How entrySet() Is More Efficient
Java Tech Enthusiast
Java Tech Enthusiast
Sep 6, 2024 · Mobile Development

Bundle vs HashMap in Android: Memory Efficiency and Performance

In Android, Bundles backed by memory‑efficient ArrayMap use binary search and shrinkable storage, making them far smaller and faster to transmit than HashMaps, whose fixed‑size growth and lack of shrinkage consume more memory; thus Parcelable Bundles are preferred for IPC, while Serializable remains suited only for persistent storage.

ArrayMapHashMapParcelable
0 likes · 5 min read
Bundle vs HashMap in Android: Memory Efficiency and Performance
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Aug 11, 2024 · Fundamentals

Understanding the Underlying Data Structure of Java HashMap

This article explains the internal architecture of Java's HashMap, covering its array of buckets, linked‑list handling of hash collisions, and the conversion to red‑black trees for high‑collision scenarios, supplemented with code examples and visual diagrams.

Data StructureHashMapJava
0 likes · 5 min read
Understanding the Underlying Data Structure of Java HashMap
Top Architect
Top Architect
Jul 27, 2024 · Backend Development

Various Ways to Iterate Over a Java HashMap with Code Examples

This article demonstrates seven common techniques for iterating over a Java HashMap—including iterator, entrySet, keySet, for‑each loops, lambda expressions, and both single‑threaded and parallel Streams API—providing concise code examples and performance notes for each method.

Code ExampleHashMapIteration
0 likes · 10 min read
Various Ways to Iterate Over a Java HashMap with Code Examples
Architect's Tech Stack
Architect's Tech Stack
Jun 1, 2024 · Backend Development

Understanding HashMap keySet Traversal and Iterator Mechanism in Java

This article explains why iterating a Java HashMap with keySet() involves two passes, examines the underlying iterator implementation, and walks through the relevant source code of HashMap’s KeySet, KeyIterator, and HashIterator classes to clarify the internal traversal mechanism.

HashMapIterationIterator
0 likes · 8 min read
Understanding HashMap keySet Traversal and Iterator Mechanism in Java
Architecture Development Notes
Architecture Development Notes
May 20, 2024 · Fundamentals

Master Rust’s HashMap: Fast Lookups, Inserts, and Advanced Techniques

This article provides a comprehensive guide to Rust's HashMap, covering its core concepts, creation, insertion, updating, value access, iteration, removal, and advanced entry strategies with clear code examples to help developers use this powerful collection efficiently.

HashMapRustcollections
0 likes · 6 min read
Master Rust’s HashMap: Fast Lookups, Inserts, and Advanced Techniques
DaTaobao Tech
DaTaobao Tech
May 8, 2024 · Fundamentals

Comprehensive Overview of Java Fundamentals

This article surveys Java fundamentals, explaining OOP principles, differences from C++, polymorphism, static/final keywords, abstract classes versus interfaces, generics with type erasure, reflection, exception handling, core data structures, HashMap internals, serialization, key design patterns, and essential language constructs for developers.

Exception HandlingHashMapJava Fundamentals
0 likes · 16 min read
Comprehensive Overview of Java Fundamentals
Architecture Digest
Architecture Digest
Apr 14, 2024 · Backend Development

Optimizing Nested Loops in Java: From O(N²) to O(N) Using HashMap

This article demonstrates how to replace a costly double‑for‑loop that matches two large lists of users with a HashMap lookup, showing performance measurements, the effect of adding a break statement, and detailed Java code examples for backend developers.

HashMapJavaNested Loops
0 likes · 7 min read
Optimizing Nested Loops in Java: From O(N²) to O(N) Using HashMap
IT Services Circle
IT Services Circle
Apr 13, 2024 · Fundamentals

Java Interview Questions: Collections, HashMap, Concurrency, JVM Memory, GC, References, and Redis

This article compiles a set of Java interview questions covering the differences between ArrayList and LinkedList, the internal workings and resizing of HashMap, concurrency primitives like synchronized and ReentrantLock, JVM memory layout, garbage‑collection algorithms, reference types, and Redis persistence and distributed‑lock mechanisms.

ConcurrencyHashMapInterview
0 likes · 21 min read
Java Interview Questions: Collections, HashMap, Concurrency, JVM Memory, GC, References, and Redis
IT Services Circle
IT Services Circle
Mar 12, 2024 · Fundamentals

LRU Cache Design and Java Implementation with O(1) Operations

This article explains the LeetCode LRU Cache problem, detailing the required class interface, operational constraints, and provides a thorough Java solution using a HashMap combined with a doubly linked list to achieve O(1) time complexity for get and put operations.

Doubly Linked ListHashMapJava
0 likes · 10 min read
LRU Cache Design and Java Implementation with O(1) Operations