Browse by Topic

Popular

Latest

Latest Java Posts

A Java TreeMap structure showing strict greater-than lookup with an arrow to the next entry.
Java

How to Use higherEntry() on a Java TreeMap

Learn how to use TreeMap.higherEntry() to find the next key-value entry in a sorted map, with practical Java examples, edge cases, and performance notes.

TreeMapSortedMapJava CollectionsNavigableMap
Illustration of a TreeMap data structure with the last entry being retrieved by the lastEntry method
Java

Java TreeMap lastEntry() Explained

Learn how to use lastEntry() on a Java TreeMap to retrieve the entry with the highest key, including examples for empty maps, custom comparators, performance, and related methods.

TreeMapJava CollectionsSortedMapNavigableMap
Diagram showing a red-black tree with the leftmost node highlighted as the first entry, representing the java treemap firstentry operation.
Java

Java TreeMap firstEntry(): How to Get the First Entry

Learn how to retrieve the lowest-key entry from a Java TreeMap using firstEntry(), with examples, performance notes, empty-map handling, and alternatives such as pollFirstEntry().

TreeMapJava CollectionsSortedMapFirst Entry
Java TreeMap comparator concept with a balanced tree structure and ordering arrows
Java

Java TreeMap Comparator: Custom Ordering and Null Handling

Learn how to control Java TreeMap ordering by supplying a custom Comparator. This article covers natural ordering, custom comparators, sorting keys by values, comparator consistency, and null-key handling.

TreeMapComparatorJava CollectionsSorting
Illustration of a TreeMap structure with keys arranged in sorted order inside a balanced tree
Java

Java TreeMap Sorting: Ordering Keys with Comparators

java treemap sorting: How TreeMap keeps keys sorted, how to control ordering with Comparators, and when sorted iteration is worth the performance cost.

TreeMapJava CollectionsComparatorSorted Map
Illustration of a balanced tree structure with sorted key-value pairs arranged in ascending order and navigation arrows between nodes.
Java

Java TreeMap Usage: Sorted Map Operations

java treemap usage: Learn how to use Java TreeMap for sorted key iteration, range queries, custom comparators, and concurrency tradeoffs versus HashMap and LinkedHashMap.

TreeMapJava CollectionsSorted MapComparator
Illustration of a Java TreeMap with sorted keys and red-black tree structure.
Java

Java TreeMap: Sorted Map Operations and Use Cases

java treemap: Understand Java TreeMap: its sorted key ordering, comparator support, performance tradeoffs, and when to use it over HashMap.

JavaTreeMapSortedMapRed-Black Tree
Diagram showing a LinkedHashMap with access order moving a recently accessed entry to the tail of the linked list
Java

Java LinkedHashMap Access Order Explained

Learn how Java's LinkedHashMap access order works, how to enable it, and how to use removeEldestEntry to build an LRU cache.

LinkedHashMapJava CollectionsLRU CacheMap Iteration Order
Illustration of a Java LinkedHashMap maintaining insertion order through a doubly linked list of entries.
Java

Java LinkedHashMap Insertion Order Explained

java linkedhashmap insertion order: Explains how LinkedHashMap preserves insertion order, how access-order mode works, and when to choose it over HashMap in Java.

LinkedHashMapJava CollectionsLRU CacheHashMap
Illustration of a Java LinkedHashMap showing ordered key-value entries linked in sequence, with the eldest entry highlighted for LRU eviction.
Java

Java LinkedHashMap Usage: Ordering and Cache Patterns

java linkedhashmap usage: Learn how to use Java LinkedHashMap for insertion-order iteration, access-order LRU caching, and deterministic map output with practical code...

LinkedHashMapJava CollectionsMap OrderingLRU Cache