Browse by Topic

Popular

Latest

Latest Java Posts

A Java Map diagram showing key-value pairs with a magnifying glass highlighting a value retrieval operation.
Java

Java Map Values: Retrieval and Null Handling

Learn how to retrieve Java Map values safely, interpret null returns, and choose the right method: get(), getOrDefault(), containsKey(), or computeIfAbsent().

JavaMapHashMapNull Handling
Illustration of a Java Map with a keySet view pointing to keys, showing iteration over keys without copying.
Java

Java Map keySet: Iterate Keys Without Copying

Learn how Java's Map.keySet() returns a live view of map keys, how to iterate keys safely, and when to prefer entrySet or forEach for better performance.

Java MapkeySetIterationCollections
Diagram of a Java Map with key-value pairs being iterated through entrySet, showing direct access to each entry.
Java

Java Map entrySet() for Iteration and Modification

Learn how to use Java's Map.entrySet() method to iterate over key-value pairs, modify entries, and understand performance and concurrency trade-offs.

JavaMapentrySetiteration
Diagram showing a Java Map with key-value pairs and an entry object highlighted for iteration.
Java

Java Map Entry: Working with Entry Objects in Maps

java map entry: Learn how to use Java Map.Entry to iterate over map entries, update values, and avoid common pitfalls in your Java applications.

javamapentrysetiteration
A Java immutable map concept showing a locked map with keys and values, representing unmodifiable collections.
Java

Creating a Java Immutable Map

Learn how to create immutable maps in Java with Map.of, Map.copyOf, and Collections.unmodifiableMap. Compare behavior, null handling, and when to choose each approach.

immutable collectionsMap.ofunmodifiable mapJava collections
Illustration of copying a Java map to an immutable map using Map.copyOf.
Java

Java Map.copyOf: Creating Immutable Map Copies

Learn how to use Java's Map.copyOf to create immutable map copies, including null handling, performance, and version requirements.

Map.copyOfImmutable MapJava CollectionsJava 10
A Java Map.of method call creating an immutable map with fixed key-value pairs, illustrated with a lock icon.
Java

Java Map.of: Creating Immutable Maps with Ease

java map of: Learn how Java Map.of creates immutable maps with fixed key-value pairs, its limits on nulls and size, and when to prefer it over other map implementations.

JavaMap.ofImmutable MapJava Collections
Illustration of Java Map methods showing key-value operations with arrows for put, get, and remove.
Java

Java Map Methods: Usage and Pitfalls

java map methods: Practical guide to Java Map methods: core operations, default methods like computeIfAbsent and merge, iteration, implementation selection, and common...

JavaMapHashMapJava Collections
Illustration of Java Map interface showing key-value pairs stored in a HashMap, with a tree symbol for TreeMap and a hash symbol for HashMap.
Java

Java Map Interface: Key-Value Storage Explained

java map interface: Understand the Java Map interface, its core methods, implementation choices, iteration patterns, and performance tradeoffs for key-value storage.

Java CollectionsHashMapMap InterfaceKey-Value Storage
Illustration of a TreeMap navigation method finding the predecessor entry below a given key.
Java

Java TreeMap lowerEntry: Find the Predecessor Entry

Learn how to use TreeMap.lowerEntry() to find the entry with the greatest key strictly less than a given key. Includes a Java example and a comparison with related navigation methods.

JavaTreeMapCollectionsSortedMap