Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #12448
| From | Lew <noone@lewscanon.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Additional logging questions |
| Date | 2012-02-27 12:32 -0800 |
| Organization | albasani.net |
| Message-ID | <jigp8t$ejo$2@news.albasani.net> (permalink) |
| References | <XnsA005D74257FB0jpnasty@94.75.214.39> <4f4ae583$0$281$14726298@news.sunsite.dk> <XnsA005ED51BFCF7jpnasty@94.75.214.39> <jif6ua$3cm$1@news.albasani.net> <XnsA0069221E7830jpnasty@94.75.214.39> |
On 02/27/2012 11:14 AM, Novice wrote: > I don't touch hashCode(), equals() or compareTo() very often at all. Or > toString() either for that matter. But overriding hashCode() and equals() > solved a big problem for me recently. I was writing a holder class that > contained three fields, a table name, a row number and a column number, > as a key for a hash map and then storing the column width in the value > portion of the map. But when I tried to look up a given combination of > table name, row number and column number I was never finding values that > I knew were there. I googled and found out that I needed to revise > hashCode() and equals() and rougly what those changes needed to be and > then my lookups went fine. But I didn't touch compareTo(). Hmm, maybe I > need to revisit that and make sure it doesn't need some tweaking too.... Read the Javadocs for those methods. 'compareTo()' is not universal, being present only in instances of 'Comparable<T>'. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Additional logging questions Novice <novice@example..com> - 2012-02-27 02:02 +0000
Re: Additional logging questions Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 21:08 -0500
Re: Additional logging questions Novice <novice@example..com> - 2012-02-27 04:12 +0000
Re: Additional logging questions Lew <noone@lewscanon.com> - 2012-02-26 22:13 -0800
Re: Additional logging questions Novice <novice@example..com> - 2012-02-27 19:14 +0000
Re: Additional logging questions Lew <noone@lewscanon.com> - 2012-02-27 12:32 -0800
Re: Additional logging questions Lew <noone@lewscanon.com> - 2012-02-27 13:06 -0800
Re: Additional logging questions Novice <novice@example..com> - 2012-02-28 01:48 +0000
Re: Additional logging questions Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 20:57 -0500
Re: Additional logging questions Lew <noone@lewscanon.com> - 2012-02-27 23:51 -0800
Re: Additional logging questions Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 20:50 -0500
Re: Additional logging questions Lew <noone@lewscanon.com> - 2012-02-27 23:57 -0800
Re: Additional logging questions Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 20:45 -0500
Re: Additional logging questions Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-02-28 01:52 -0600
Re: Additional logging questions Arne Vajhøj <arne@vajhoej.dk> - 2012-02-28 17:20 -0500
Re: Additional logging questions Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-28 20:26 -0400
Re: Additional logging questions Arne Vajhøj <arne@vajhoej.dk> - 2012-02-27 20:34 -0500
Re: Additional logging questions Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-27 12:36 -0800
Re: Additional logging questions Novice <novice@example..com> - 2012-02-28 01:43 +0000
csiph-web