A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
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
How To Ask Questions
How To Answer Questions
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-2014