Tagged articles
23 articles
Page 1 of 1
Architect's Tech Stack
Architect's Tech Stack
Aug 3, 2023 · Fundamentals

Performance Comparison of Different Java List Deduplication Methods

This article examines several Java deduplication techniques—including List.contains, HashSet, double-loop removal, and Stream.distinct—by providing sample code, measuring execution time on a 20,000‑element list, and analyzing their time complexities to guide developers toward efficient duplicate‑removal strategies.

CollectionsJavaStream
0 likes · 7 min read
Performance Comparison of Different Java List Deduplication Methods
Programmer DD
Programmer DD
Jun 13, 2023 · Backend Development

Why list.contains Is So Slow: Java Deduplication Performance Showdown

This article compares several Java duplicate‑removal techniques—including list.contains, HashSet, double‑loop removal, and Stream.distinct—by generating a 20 000‑element test list, measuring execution time, and explaining the underlying algorithmic complexities that make some approaches dramatically faster than others.

ListStreamdeduplication
0 likes · 7 min read
Why list.contains Is So Slow: Java Deduplication Performance Showdown
政采云技术
政采云技术
May 31, 2022 · Fundamentals

Efficient Parent‑Child Relationship Deduplication Using Hashset Caching

This article presents an efficient deduplication algorithm for parent‑child relationship validation that caches intermediate results in a hashset to eliminate redundant computations, dramatically improving performance and scalability for large datasets by reducing verification steps through stored validated nodes.

Parent-ChildPerformance Optimizationdeduplication
0 likes · 11 min read
Efficient Parent‑Child Relationship Deduplication Using Hashset Caching
Programmer DD
Programmer DD
Aug 14, 2021 · Fundamentals

Why Overriding hashCode() Matters: Java HashSet Gotchas Explained

This article explains the purpose of Java's hashCode() and equals() methods, outlines the rules for overriding them, demonstrates common pitfalls with HashSet through a concrete code example, and clarifies why both methods must be overridden when using custom objects as HashMap keys.

CollectionsHashMapJava
0 likes · 6 min read
Why Overriding hashCode() Matters: Java HashSet Gotchas Explained
Architecture Digest
Architecture Digest
Apr 16, 2021 · Backend Development

Five Methods to Remove Duplicates from a Java ArrayList

This article presents five distinct techniques for eliminating duplicate elements from a Java ArrayList, including using LinkedHashSet, Java 8 Stream distinct, HashSet with order preservation, manual contains checks, and a double‑for‑loop approach, each accompanied by complete code examples and output results.

ArrayListCollectionsJava
0 likes · 6 min read
Five Methods to Remove Duplicates from a Java ArrayList
Top Architect
Top Architect
Jan 29, 2021 · Fundamentals

Five Ways to Remove Duplicates from a Java ArrayList

This article presents five distinct methods for eliminating duplicate elements from a Java ArrayList, including using LinkedHashSet, Java 8 streams, HashSet with order preservation, manual iteration with contains checks, and nested loops, each accompanied by complete code examples and output results.

ArrayListJavaStreams
0 likes · 6 min read
Five Ways to Remove Duplicates from a Java ArrayList
FunTester
FunTester
Nov 12, 2020 · Fundamentals

How to Compute the Union of Two Arrays in Java Using HashSet

This tutorial demonstrates step‑by‑step how to obtain the union of two arrays in Java—both primitive and object types—by leveraging a HashSet with addAll, includes full code examples, console output, and a concise Groovy alternative.

Array UnionCollectionsGroovy
0 likes · 5 min read
How to Compute the Union of Two Arrays in Java Using HashSet
IT Xianyu
IT Xianyu
Oct 12, 2020 · Fundamentals

Understanding equals() and hashCode() in Java: When They Matter

This article explains the roles of equals() and hashCode() in Java, demonstrates how their interaction affects hash‑based collections like HashSet, provides multiple code examples showing correct and incorrect implementations, and outlines essential principles for overriding these methods to ensure proper object equality handling.

CollectionsJavaObject Equality
0 likes · 9 min read
Understanding equals() and hashCode() in Java: When They Matter
Wukong Talks Architecture
Wukong Talks Architecture
Aug 31, 2020 · Fundamentals

Understanding Thread Safety Issues in Java Collections: ArrayList, HashSet, HashMap and Their Solutions

This article explains why core Java collection classes such as ArrayList, HashSet, and HashMap are not thread‑safe, demonstrates the underlying mechanisms of their initialization and resizing, and presents multiple approaches—including Vector, synchronized wrappers, and CopyOnWrite variants—to achieve safe concurrent access.

ArrayListHashMapJava
0 likes · 16 min read
Understanding Thread Safety Issues in Java Collections: ArrayList, HashSet, HashMap and Their Solutions
Selected Java Interview Questions
Selected Java Interview Questions
Aug 2, 2020 · Fundamentals

Understanding Java HashSet: Overview, Constructors, add/remove Methods, Traversal, and Related Set Implementations

This article explains the internal workings of Java's HashSet, covering its overview, various constructors, the add and remove operations implemented via HashMap, traversal techniques, and how LinkedHashSet and TreeSet extend HashSet functionality, providing code examples and conceptual diagrams.

Backend DevelopmentCollectionsJava
0 likes · 10 min read
Understanding Java HashSet: Overview, Constructors, add/remove Methods, Traversal, and Related Set Implementations
Programmer DD
Programmer DD
May 14, 2020 · Backend Development

How Does Java’s HashSet Ensure No Duplicate Elements?

This article explains how Java's HashSet implementation guarantees element uniqueness by internally using a HashMap, detailing its constructors, internal fields, the add method, and the underlying HashMap put and putVal logic that handles collisions and duplicate detection.

CollectionsDuplicateHashMap
0 likes · 6 min read
How Does Java’s HashSet Ensure No Duplicate Elements?
FunTester
FunTester
Mar 21, 2020 · Fundamentals

How to Find Duplicate Numbers in an Array in O(n) Time and O(1) Space

This article explains two algorithmic solutions for locating any duplicate number in an array of length n where values range from 0 to n‑1: a straightforward HashSet method using O(n) extra space and an in‑place swapping technique that achieves O(1) space, complete with Java and JavaScript code examples and complexity analysis.

ArrayJavaJavaScript
0 likes · 5 min read
How to Find Duplicate Numbers in an Array in O(n) Time and O(1) Space
Programmer DD
Programmer DD
Aug 8, 2019 · Backend Development

Why Overriding hashCode and equals Is Critical: Avoid Memory Leaks and Bucket Chaos in Java

This article explains the contract between hashCode() and equals() in Java, shows the problems caused by violating it—such as incorrect behavior in HashMap/HashSet and memory leaks—and provides practical guidelines and code examples for implementing robust hashCode methods, including the use of Apache's HashCodeBuilder.

HashMapImmutable ObjectsJava
0 likes · 15 min read
Why Overriding hashCode and equals Is Critical: Avoid Memory Leaks and Bucket Chaos in Java
Programmer DD
Programmer DD
Nov 12, 2018 · Backend Development

Why Did My Java ThreadPool Hang? Uncovering a Hidden HashSet Loop in JDK 1.7

A production Java service suffered a thread‑pool alarm due to an unbounded LinkedBlockingQueue and a non‑thread‑safe HashSet, leading to massive memory usage, a circular linked‑list loop in HashMap, and severe CPU load, which was resolved by switching to ConcurrentHashMap and tuning the pool.

JavaMemoryAnalysisThreadPool
0 likes · 8 min read
Why Did My Java ThreadPool Hang? Uncovering a Hidden HashSet Loop in JDK 1.7
Java Captain
Java Captain
Sep 25, 2017 · Fundamentals

Java Collection Framework Overview with Code Examples

This article explains the Java collection class diagram, distinguishes concrete classes, abstract classes, and interfaces, describes Iterator and ListIterator behavior, and provides detailed code demonstrations of HashSet, ArrayList, ListIterator, and WeakHashMap usage along with their outputs.

ArrayListData StructuresIterator
0 likes · 13 min read
Java Collection Framework Overview with Code Examples