Browse by Topic
Popular
Popular Posts
Latest
Latest Java Posts
Java Inheritance vs Composition: How to Decide
Learn when to use inheritance vs composition in Java, with code examples, tradeoffs, and practical guidance for maintainable design.
Java Composition: Using Has-A Relationships Effectively
Learn how Java composition models has-a relationships, when to prefer it over inheritance, and how it improves maintainability and testability.
Defensive Copying in Java Collections: Protect Internal State
Use defensive copying in Java collections to protect internal state, avoid unintended mutation, and decide when copies are safer than unmodifiable views.
Java Defensive Copy: When and How to Use It
Learn how defensive copying in Java protects mutable state, when to apply it, and how to avoid common pitfalls in constructors, getters, collections, arrays, and cloning.
Creating Immutable Classes in Java: A Practical Guide
Learn how to create immutable classes in Java with final fields, defensive copying, records, and builder patterns. Includes common pitfalls.
Java Immutable Object: Implementation and Use Cases
Learn how to design immutable objects in Java, including final fields, defensive copying, and records, and why they improve concurrency safety.
Java Immutable Class: Design and Implementation
Learn how to design immutable classes in Java: final fields, no setters, defensive copying, and why they simplify concurrency and caching.
Java Immutability: Building Safe Immutable Classes
A practical guide to implementing immutable classes in Java: final fields, defensive copying, records, and the tradeoffs to weigh before making every class immutable.
Java HashMap vs ConcurrentHashMap: Choosing the Right Map for Concurrency
java hashmap vs concurrenthashmap: Compare Java HashMap and ConcurrentHashMap: thread safety, performance, null handling, and atomic operations to choose the right map...
Using Java ConcurrentLinkedQueue for Lock-Free Thread-Safe Queues
Learn how to use Java's ConcurrentLinkedQueue for lock-free, thread-safe queue operations, including iteration behavior, performance tradeoffs, and common pitfalls.