Tag

compareTo

1 views collected around this technical thread.

Full-Stack Internet Architecture
Full-Stack Internet Architecture
Sep 27, 2020 · Fundamentals

Understanding BigDecimal.equals: How Value and Scale Affect Equality in Java

This article explains why Java's BigDecimal.equals method compares both numeric value and scale, demonstrates common pitfalls with == and equals, shows experimental results for different constructors, and recommends using compareTo for value‑only comparisons to avoid unexpected false outcomes.

BigDecimalJavacompareTo
0 likes · 8 min read
Understanding BigDecimal.equals: How Value and Scale Affect Equality in Java
Java Captain
Java Captain
Dec 28, 2017 · Fundamentals

Java Programming Essentials: Implementing equals, hashCode, compareTo, clone, and Common Idioms

This article presents a collection of essential Java programming practices, covering how to correctly implement equals, hashCode, compareTo, clone, use StringBuilder, generate random numbers, manage threads, handle I/O with try‑finally, perform defensive checks, and manipulate arrays and primitive packing.

CollectionsHashCodeJava
0 likes · 14 min read
Java Programming Essentials: Implementing equals, hashCode, compareTo, clone, and Common Idioms