Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18477

Re: hashCode

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: hashCode
Date Fri, 31 Aug 2012 17:55:32 +0200
Lines 33
Message-ID <aac53sFoqmU1@mid.individual.net> (permalink)
References <563f186a-edb3-4311-ae48-3af7decfce2c@googlegroups.com> <502598d0$0$287$14726298@news.sunsite.dk> <a8pv38F9ouU1@mid.individual.net> <5028191b$0$290$14726298@news.sunsite.dk> <a8sr5sFropU1@mid.individual.net> <50317b03$0$281$14726298@news.sunsite.dk> <slrnk36phl.u9l.avl@gamma.logic.tuwien.ac.at> <503bfd0f$0$282$14726298@news.sunsite.dk> <CNT_r.5387$pd4.3890@newsfe21.iad> <k1h1sp$qdf$1@dont-email.me> <PPadnUGBC8NIuKHNnZ2dnUVZ_gudnZ2d@earthlink.com> <k1hgt4$vk5$1@dont-email.me> <BbednWMHAfFh5qHNnZ2dnUVZ_r-dnZ2d@earthlink.com> <k1ir2n$au0$1@dont-email.me> <3zc%r.5945$pd4.2658@newsfe21.iad> <k1jm6i$s5k$1@dont-email.me> <zSs%r.2724$Wh5.2588@newsfe14.iad> <k1lo7d$835$1@dont-email.me> <k1oqsq$p0u$1@dont-email.me> <k1p4rh$im0$1@dont-email.me> <k1p6vk$s4p$1@dont-email.me> <ydnzk5brte4.fsf@shell.xmission.com> <k1qlpa$kjv$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net 5FcM3fBs9D2iM9rSfxJpPQgJKcKE6/UMOE7t8QsAOef/6h+Qv5n6AO5N6X/E9Uf0U=
Cancel-Lock sha1:70VoqFURVzDBhd04gHAMEn5Eem8=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0
In-Reply-To <k1qlpa$kjv$1@dont-email.me>
Xref csiph.com comp.lang.java.programmer:18477

Show key headers only | View raw


On 31.08.2012 17:38, Eric Sosman wrote:
> On 8/31/2012 11:08 AM, Jim Janney wrote:
>> Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> writes:
>>
>>> On 31/08/2012 03:43, Eric Sosman allegedly wrote:
>>>> On 8/30/2012 6:52 PM, Daniele Futtorovic wrote:
>>>> [...]
>>>> As an example of why a hasher might want access to a strictly-private
>>>> field, I offered String: [...]
>>>
>>> Imposing that classes should expose all information "relevant" (says
>>> who??) to hashing is utter rubbish IMNSHO.
>>
>> Objects that compare equal must hash to the same value.  It follows that
>> if the hash function uses a value, so must the comparison method.
>
>      Since java.lang.String had already been mentioned, it's sort
> of too bad you didn't look at it before posting.  Had you done so,
> you'd have found that [1] hashCode() uses the private field `hash'
> and [2] equals() does not.

Well, Jim's wording may not be correct to the last bit but the message 
is still true: String's hash member just caches the hash code derived 
from the characters of the String.  And obviously equals() must compare 
the characters.  So basically both recur to the same underlying data.

Cheers

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

hashCode bob smith <bob@coolfone.comze.com> - 2012-08-10 08:47 -0700
  Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-10 12:13 -0400
    Re: hashCode markspace <-@.> - 2012-08-10 10:13 -0700
      Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-10 13:38 -0400
        Re: hashCode rossum <rossum48@coldmail.com> - 2012-08-11 10:36 +0100
  Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-10 12:34 -0400
    Re: hashCode bob smith <bob@coolfone.comze.com> - 2012-08-10 15:22 -0700
      Re: hashCode Lew <lewbloch@gmail.com> - 2012-08-10 15:32 -0700
        Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-10 19:30 -0400
          Re: hashCode Lew <noone@lewscanon.com> - 2012-08-11 16:24 -0700
            Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-11 22:15 -0400
              Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-11 22:29 -0400
                Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-11 22:43 -0400
                Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-11 22:54 -0400
                Re: hashCode Lew <noone@lewscanon.com> - 2012-08-11 21:46 -0700
                Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-12 16:53 -0400
                Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-12 17:00 -0400
      Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-10 19:27 -0400
        Re: hashCode Robert Klemme <shortcutter@googlemail.com> - 2012-08-12 17:06 +0200
          Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-12 16:59 -0400
            Re: hashCode Robert Klemme <shortcutter@googlemail.com> - 2012-08-13 19:17 +0200
              Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-19 19:42 -0400
                Re: hashCode Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-08-21 10:30 +0000
              Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-19 19:47 -0400
                Re: hashCode Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-08-21 10:43 +0000
                Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-27 19:04 -0400
                Re: hashCode Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-27 16:55 -0700
                Re: hashCode markspace <-@.> - 2012-08-27 17:03 -0700
                Re: hashCode Lew <lewbloch@gmail.com> - 2012-08-27 17:49 -0700
                Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-27 21:37 -0400
                Re: hashCode Patricia Shanahan <pats@acm.org> - 2012-08-27 18:58 -0700
                Re: hashCode markspace <-@.> - 2012-08-27 21:19 -0700
                Re: hashCode Patricia Shanahan <pats@acm.org> - 2012-08-28 01:06 -0700
                Re: hashCode markspace <-@.> - 2012-08-28 09:19 -0700
                Re: hashCode Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-28 16:33 -0700
                Re: hashCode markspace <-@.> - 2012-08-28 17:02 -0700
                Re: hashCode Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-29 11:06 -0700
                Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-29 14:49 -0400
                Re: hashCode Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-29 13:40 -0700
                Re: hashCode Gene Wirchenko <genew@ocis.net> - 2012-08-29 18:02 -0700
                Re: hashCode Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-08-31 00:52 +0200
                Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-30 21:43 -0400
                Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-30 21:52 -0400
                Re: hashCode Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-08-31 04:18 +0200
                Re: hashCode Jim Janney <jjanney@shell.xmission.com> - 2012-08-31 09:08 -0600
                Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-31 11:38 -0400
                Re: hashCode Robert Klemme <shortcutter@googlemail.com> - 2012-08-31 17:55 +0200
                Re: hashCode Jim Janney <jjanney@shell.xmission.com> - 2012-08-31 09:56 -0600
                Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-31 14:32 -0400
                Re: hashCode Jim Janney <jjanney@shell.xmission.com> - 2012-08-31 14:38 -0600
                Re: hashCode Lew <lewbloch@gmail.com> - 2012-08-31 15:33 -0700
                Re: hashCode Jim Janney <jjanney@shell.xmission.com> - 2012-08-31 16:41 -0600
                Re: hashCode Lew <lewbloch@gmail.com> - 2012-08-31 16:26 -0700
                Re: hashCode Jim Janney <jjanney@shell.xmission.com> - 2012-09-02 11:54 -0600
                Re: hashCode Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-09-03 00:47 +0200
                Re: hashCode Jim Janney <jjanney@shell.xmission.com> - 2012-09-03 21:44 -0600
                Re: hashCode Jim Janney <jjanney@shell.xmission.com> - 2012-08-31 09:08 -0600
                Re: hashCode Robert Klemme <shortcutter@googlemail.com> - 2012-08-31 17:58 +0200
                Re: hashCode markspace <-@.> - 2012-08-29 11:51 -0700
                Re: hashCode Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-29 13:28 -0700
                Re: hashCode markspace <-@.> - 2012-08-29 16:05 -0700
                Re: hashCode Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-29 16:23 -0700
                Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-29 20:56 -0400
                Re: hashCode Jan Burse <janburse@fastmail.fm> - 2012-08-30 11:19 +0200
                Re: hashCode Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-30 10:03 -0700
                Re: hashCode Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-08-30 18:34 +0000
                Re: hashCode Jim Janney <jjanney@shell.xmission.com> - 2012-08-30 08:11 -0600
                Re: hashCode Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-08-30 10:06 -0700
                Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-30 19:16 -0400
                Re: hashCode Lew <lewbloch@gmail.com> - 2012-08-28 13:58 -0700
                Re: hashCode Lew <lewbloch@gmail.com> - 2012-08-28 13:56 -0700
                Re: hashCode Patricia Shanahan <pats@acm.org> - 2012-08-28 14:07 -0700
                Re: hashCode Lew <lewbloch@gmail.com> - 2012-08-28 14:38 -0700
                Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-27 21:12 -0400
      Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-11 07:58 -0400
        Re: hashCode Lew <noone@lewscanon.com> - 2012-08-11 16:29 -0700
          Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-11 22:16 -0400
      Re: hashCode Patricia Shanahan <pats@acm.org> - 2012-08-12 03:46 -0700
      Re: hashCode Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-08-12 12:23 -0400
        Re: hashCode Patricia Shanahan <pats@acm.org> - 2012-08-12 09:40 -0700
          Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-12 13:59 -0400
            Re: hashCode Patricia Shanahan <pats@acm.org> - 2012-08-12 11:17 -0700
          Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-12 17:02 -0400
        Re: hashCode Jan Burse <janburse@fastmail.fm> - 2012-08-12 19:03 +0200
  Re: hashCode Roedy Green <see_website@mindprod.com.invalid> - 2012-08-10 12:17 -0700
    Re: hashCode Lew <lewbloch@gmail.com> - 2012-08-10 12:45 -0700
      Re: hashCode Roedy Green <see_website@mindprod.com.invalid> - 2012-08-11 04:54 -0700
        Re: hashCode Joerg Meier <joergmmeier@arcor.de> - 2012-08-11 18:25 +0200
          Re: hashCode Mike Winter <usenet@michael-winter.me.invalid> - 2012-08-11 18:53 +0100
        Re: hashCode Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-08-11 09:56 -0700
        Re: hashCode Jan Burse <janburse@fastmail.fm> - 2012-08-11 18:58 +0200
        Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-11 22:40 -0400
      Re: hashCode rossum <rossum48@coldmail.com> - 2012-08-11 18:47 +0100
    Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-10 19:25 -0400
      Re: hashCode Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-11 08:00 -0400
        Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-11 09:49 -0400
  Re: hashCode Jan Burse <janburse@fastmail.fm> - 2012-08-11 15:33 +0200
    Re: hashCode Jan Burse <janburse@fastmail.fm> - 2012-08-11 15:34 +0200
    Re: hashCode Lew <noone@lewscanon.com> - 2012-08-11 16:34 -0700
      Re: hashCode Lew <noone@lewscanon.com> - 2012-08-11 16:37 -0700
      Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-11 22:19 -0400
        Re: hashCode Lew <noone@lewscanon.com> - 2012-08-11 21:48 -0700
    Re: hashCode Jan Burse <janburse@fastmail.fm> - 2012-08-12 12:08 +0200
      Re: hashCode Jan Burse <janburse@fastmail.fm> - 2012-08-12 12:18 +0200
      Re: hashCode Lew <noone@lewscanon.com> - 2012-08-12 11:27 -0700
        Re: hashCode Arne Vajhøj <arne@vajhoej.dk> - 2012-08-12 17:11 -0400

csiph-web