Java guides
Every published Java guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular Java guides
Most readLatest Java guides
Page 51 of 109Java HashMap computeIfAbsent: Syntax and Use Cases
Learn how HashMap.computeIfAbsent works: its syntax and behavior, and when to choose it over putIfAbsent or compute for building maps.
Java HashMap compute: In-Place Value Updates
HashMap.compute updates an entry in place with a remapping function. See when to use it, how it differs from merge and computeIfAbsent, and common pitfalls.
Java HashMap replace: Update Existing Entries
java hashmap replace: Learn how the Java HashMap replace method works, its two overloads, return values, and when to use it instead of put.
How HashMap containsValue Works in Java
java hashmap containsvalue: Learn how HashMap.containsValue works in Java, including its O(n) time complexity, equals-based comparison, null handling, and when to pref...
Java HashMap containsKey: Usage and Performance
Learn how to use HashMap.containsKey to check key existence, understand its null-key behavior, performance, and common pitfalls in Java.
Java HashMap remove: Syntax, Return Values, and Pitfalls
Learn how to remove entries from a Java HashMap, including return values, null handling, iteration safety, performance tradeoffs, and common pitfalls.
Using HashMap getOrDefault in Java
Learn how to use HashMap.getOrDefault in Java to return a fallback value for missing keys, handle null values correctly, and avoid verbose null checks.
Java HashMap get(): Lookup Behavior and Common Pitfalls
Understand how Java's HashMap.get() works, including hashing behavior, performance, null handling, thread safety, and common mistakes when retrieving values.
Java HashMap putIfAbsent: Usage and Behavior
Understand how Java HashMap putIfAbsent works: its return value, null-handling behavior, concurrency implications, and when to prefer it over put or computeIfAbsent.
Java HashMap put: Behavior, Return Value, and Performance
java hashmap put: Understand how HashMap.put works: return value, null handling, collisions, resizing, and performance tradeoffs in Java.