This week's book giveaway is in the
We're giving away four copies of
and have Sam Newman on-line!
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Enum class - equals() and hashCode() ?
Joined: Apr 08, 2004
Dec 18, 2010 20:38:46
Whether enum classes need object's equals() and hashCode() ?
Joined: Oct 13, 2005
Dec 19, 2010 02:04:10
Start in the
Java™ Language Specification
. Remember enum members are singletons, so == is adequate as a
Joined: Oct 27, 2005
Dec 19, 2010 03:12:47
Besides, all enum classes implicitly extend
which has final implementations of both. equals uses == and hashCode uses Object.hashCode. Try overriding them in any enum and you'll get a compiler error.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Enum class - equals() and hashCode() ?
map method containsKey
what is hashcode and equals contract?
Cannot understand enum class syntax
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015