Robert

20%
Flag icon
For example, consider the BigDecimal class, whose compareTo method is inconsistent with equals. If you create a HashSet instance and add new BigDecimal("1.0") and new BigDecimal("1.00"), the set will contain two elements because the two BigDecimal instances added to the set are unequal when compared using the equals method.
Robert
Why isn't this a bug?
Effective Java: A Programming Language Guide (Java Series)
Rate this book
Clear rating
Open Preview