Re: hashCode

Discussion in 'Java' started by Lew, Aug 13, 2012.

  1. Lew

    Lew Guest

    To: Lew
    From: "Lew" <lew@1:261/38.remove-m2z-this>

    To: Lew
    From: Lew <>

    Lew wrote:
    > Jan Burse wrote:
    >> Maybe it would make sense to spell out what the contract
    >> for hashCode() is. Well the contract is simply, the
    >> following invariant should hold:
    >>
    >> /* invariant that should hold */
    >> if a.equals(b) then a.hashCode()==b.hashCode()

    >
    > True, but if you read the specification for 'hashCode()' fully, that is not
    > the entire contract, only the compiler-enforceable part of it.


    Oooops!

    I made a mistake.

    Not even that is compiler-enforceable.

    --
    Lew
    Honi soit qui mal y pense.
    http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

    -+- BBBS/Li6 v4.10 Dada-1
    + Origin: Prism bbs (1:261/38)
    -+- Synchronet 3.16a-Win32 NewsLink 1.98
    Time Warp of the Future BBS - telnet://time.synchro.net:24

    --- BBBS/Li6 v4.10 Dada-1
    * Origin: Prism bbs (1:261/38)
    --- Synchronet 3.16a-Win32 NewsLink 1.98
    Time Warp of the Future BBS - telnet://time.synchro.net:24
    Lew, Aug 13, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roedy Green

    hashCode for byte[]

    Roedy Green, Aug 22, 2003, in forum: Java
    Replies:
    1
    Views:
    419
    Dale King
    Aug 22, 2003
  2. Marco
    Replies:
    10
    Views:
    766
  3. Gregory A. Swarthout

    equals and hashCode

    Gregory A. Swarthout, Dec 19, 2003, in forum: Java
    Replies:
    2
    Views:
    349
    Silvio Bierman
    Dec 20, 2003
  4. kelvSYC

    Designing hashCode() methods

    kelvSYC, Dec 23, 2003, in forum: Java
    Replies:
    1
    Views:
    373
    Ulrich Stern
    Dec 24, 2003
  5. Dimitri Pissarenko

    Hashcode of primitive types

    Dimitri Pissarenko, Jan 29, 2004, in forum: Java
    Replies:
    5
    Views:
    5,839
    Hylander
    Jan 29, 2004
Loading...

Share This Page