Browse by Topic

Popular

Latest

Latest Java Posts

Illustration of a Java LinkedHashMap showing ordered entries with a linked list connecting them, representing insertion and access order.
Java

Java LinkedHashMap: Ordering and LRU Cache Use

Learn how Java's LinkedHashMap maintains insertion or access order, and how to build a simple LRU cache by overriding removeEldestEntry.

LinkedHashMapJava CollectionsLRU CacheMap Ordering
Side-by-side comparison of a HashMap bucket structure and a TreeMap sorted tree structure, illustrating the difference in ordering and performance.
Java

Java HashMap vs TreeMap: Choosing the Right Map

Compare HashMap and TreeMap in Java: ordering guarantees, performance, null handling, and when to choose each implementation.

HashMapTreeMapJava CollectionsMap Ordering
Comparison of Java HashMap and LinkedHashMap showing order preservation
Java

Java HashMap vs LinkedHashMap: Key Differences

Understand the differences between Java HashMap and LinkedHashMap: iteration order, performance tradeoffs, and when to choose each.

JavaHashMapLinkedHashMapCollections
A visual comparison between Java HashMap and Hashtable showing key differences in synchronization and null handling.
Java

Java HashMap vs Hashtable: Key Differences

HashMap and Hashtable both implement the Map interface in Java, but they differ in synchronization, null support, iteration, and performance. Learn when to use HashMap, Hashtable, or ConcurrentHashMap.

HashMapHashtableConcurrencyCollections
Illustration of Java HashMap buckets with keys and hashed values.
Java

Java HashMap equals and hashCode

java hashmap equals hashcode: Understand how equals and hashCode affect HashMap lookups, why the contract matters, and how to implement keys correctly.

HashMapequalshashCodeJava collections
Illustration of sorting objects in Java using a compare method, showing two objects being ordered with a comparator.
Java

How to Implement Java compare Method Correctly

Learn how to implement the java compare method correctly using Comparator and Comparable, covering contracts, null handling, and practical sorting examples.

JavaComparatorSortingComparable
Java text block syntax on a code editor with indentation marked, illustrating multiline string creation.
Java

Java Multiline String: Text Blocks and Alternatives

Learn practical techniques for multiline strings in Java, including text blocks, concatenation, formatting, escaping, and alternatives for older Java versions.

Java Text BlocksJava String SyntaxJava 15String Formatting
Java arithmetic operators displayed on a code editor with a magnifying glass over the division sign, emphasizing precision and edge cases.
Java

Java Arithmetic: Addition, Subtraction, Multiplication, and Division

Learn how Java handles addition, subtraction, multiplication, and division, including integer truncation, remainder signs, floating-point precision, overflow, and division by zero.

Arithmetic OperatorsInteger DivisionBigDecimalFloating-Point Precision
Diagram showing how HashMap entries are distributed across a bucket array with linked lists handling collisions
Java

Java HashMap Internal Working Explained

java hashmap internal working: Explains how Java HashMap stores entries in a bucket array, handles collisions with linked lists and trees, and resizes based on load fa...

JavaHashMapData StructuresHashing
A visual metaphor of a HashMap with unordered entries scattered across buckets, illustrating unpredictable iteration order.
Java

Java HashMap Order: Why Iteration Order Is Not Guaranteed

java hashmap order: Understand why HashMap does not guarantee iteration order, how hashing affects it, and when to use LinkedHashMap or TreeMap.

HashMapJava CollectionsLinkedHashMapTreeMap