Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #20548
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Lars Enderin <lars.enderin@telia.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Need clarification on Object.equals. |
| Date | Wed, 19 Dec 2012 17:43:46 +0100 |
| Organization | albasani.net |
| Lines | 30 |
| Message-ID | <50D1EEC2.6090607@telia.com> (permalink) |
| References | <e6f674ec-f00d-4b22-bc02-e1c0ff9ff196@oi3g2000pbb.googlegroups.com> <d8WdnQ4s7tp82k3NnZ2dnUVZ8smdnZ2d@bt.com> <vfp0d8pore6p95616o2tao4isi2jvpsqas@4ax.com> <14r3pk5hnnuce.1fmlq04hracjd.dlg@40tude.net> <7f86e17c-72f6-4b87-948d-9ee8ad102390@googlegroups.com> <50d1e9c7$0$289$14726298@news.sunsite.dk> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.albasani.net ppLhTfoOFWNwVyaltb+92q6DJCGzcmfu8ghZzefyLG2d1bfW2sENTKYSQmx5smF1/zGwhilRv+sX+WnPGrFk9udlSFkl5X+eG/ChLzytNzwre/+pZ3hABfjpooUMtg19 |
| NNTP-Posting-Date | Wed, 19 Dec 2012 16:44:31 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="8eHkECiz2ssuw4vtOy46hjgSjfe4SMXkiBV4pNTLFnB3UNSA4ZnjKcuSaAoQtDE1uF95e49l81YUwEwtWtFlmSDyAYSk9rOC/c0IFfiR+C2DDo9FpSks3vmj4k+Gfl0i"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
| In-Reply-To | <50d1e9c7$0$289$14726298@news.sunsite.dk> |
| Cancel-Lock | sha1:gLW0troL2TseTKN4F0xUqQLxyNw= |
| Xref | csiph.com comp.lang.java.programmer:20548 |
Show key headers only | View raw
2012-12-19 17:22, Arne Vajhøj skrev: > On 12/19/2012 11:13 AM, FredK wrote: >> On Tuesday, December 18, 2012 10:56:19 AM UTC-8, Peter Duniho wrote: >>> On Tue, 18 Dec 2012 04:48:16 -0800, Roedy Green wrote: >>>>> Node a = new Gate(); >>>>> Monitor b = new Monitor(); >>>>> System.out.println(a.equals(b)); // --> prints 'true' >>>> Gate or one of its superclasses is implementing equals. >>> And doing it incorrectly, I'd say. >> >> Why would you think it was done incorrectly? >> For most classes, a.equals(b) is not the same as a==b. >> Think about string: >> string a = "abc"); >> string b = new string(a); >> Clearly a==b is false, but a.equals(b) is true. >> >> Usually the equals() method returns true if the internal state of both >> objects is the same. > > It is rather unusual to have objects of different classes considered > equals. > > Your example is different. Both Gate and Monitor were extensions of AbstractSet, and empty, which eventually led to Set#containsAll, and thus equals, returning true. -- Lars Enderin
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Need clarification on Object.equals. "plewto@gmail.com" <plewto@gmail.com> - 2012-12-18 00:13 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-18 10:39 +0000
Re: Need clarification on Object.equals. Roedy Green <see_website@mindprod.com.invalid> - 2012-12-18 04:48 -0800
Re: Need clarification on Object.equals. Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-18 10:56 -0800
Re: Need clarification on Object.equals. FredK <fred.l.kleinschmidt@gmail.com> - 2012-12-19 08:13 -0800
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 11:22 -0500
Re: Need clarification on Object.equals. Lars Enderin <lars.enderin@telia.com> - 2012-12-19 17:43 +0100
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 12:06 -0500
Re: Need clarification on Object.equals. Patricia Shanahan <pats@acm.org> - 2012-12-19 09:39 -0800
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 13:24 -0500
Re: Need clarification on Object.equals. FredK <fred.l.kleinschmidt@gmail.com> - 2012-12-19 11:23 -0800
Re: Need clarification on Object.equals. Patricia Shanahan <pats@acm.org> - 2012-12-19 08:25 -0800
Re: Need clarification on Object.equals. plewto@gmail.com - 2012-12-18 10:56 -0800
Re: Need clarification on Object.equals. Jim Janney <jjanney@shell.xmission.com> - 2012-12-18 14:24 -0700
Re: Need clarification on Object.equals. Patricia Shanahan <pats@acm.org> - 2012-12-18 13:52 -0800
Re: Need clarification on Object.equals. markspace <-@.> - 2012-12-18 10:24 -0800
Re: Need clarification on Object.equals. plewto@gmail.com - 2012-12-18 10:48 -0800
Re: Need clarification on Object.equals. David Lamb <dalamb@cs.queensu.ca> - 2012-12-18 14:01 -0500
Re: Need clarification on Object.equals. plewto@gmail.com - 2012-12-18 12:14 -0800
Re: Need clarification on Object.equals. plewto@gmail.com - 2012-12-18 12:17 -0800
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 22:16 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 10:20 +0000
Re: Need clarification on Object.equals. Patricia Shanahan <pats@acm.org> - 2012-12-19 03:22 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 12:06 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 09:07 -0500
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 09:09 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 14:36 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 09:42 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 15:05 +0000
Re: Need clarification on Object.equals. Lars Enderin <lars.enderin@telia.com> - 2012-12-19 16:15 +0100
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 15:47 +0000
Re: Need clarification on Object.equals. Lars Enderin <lars.enderin@telia.com> - 2012-12-19 16:57 +0100
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 16:51 +0000
Re: Need clarification on Object.equals. Lars Enderin <lars.enderin@telia.com> - 2012-12-19 18:12 +0100
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 17:27 +0000
Re: Need clarification on Object.equals. Gene Wirchenko <genew@telus.net> - 2012-12-19 11:40 -0800
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 10:17 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 15:40 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 10:50 -0500
Re: Need clarification on Object.equals. Lars Enderin <lars.enderin@telia.com> - 2012-12-19 17:01 +0100
Re: Need clarification on Object.equals. Gene Wirchenko <genew@telus.net> - 2012-12-19 10:22 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 18:49 +0000
Re: Need clarification on Object.equals. Gene Wirchenko <genew@telus.net> - 2012-12-19 11:41 -0800
Re: Need clarification on Object.equals. Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-19 17:05 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-20 08:34 +0000
Re: Need clarification on Object.equals. Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-20 07:27 -0800
Re: Need clarification on Object.equals. Gene Wirchenko <genew@telus.net> - 2012-12-20 09:04 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-20 18:10 +0000
Re: Need clarification on Object.equals. Lew <lewbloch@gmail.com> - 2012-12-20 11:08 -0800
Re: Need clarification on Object.equals. Peter Dunihơ <Np0eStPeAdM@NnOwSlPiAnMk.com> - 2012-12-21 07:50 +0000
Re: Need clarification on Object.equals. Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-21 07:30 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-21 17:09 +0000
Re: Need clarification on Object.equals. Leŵ <lewbl0ch@gmail.com> - 2012-12-23 00:54 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-21 12:23 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-21 17:38 +0000
Re: Need clarification on Object.equals. Arne Vajhoj <arne@vajhoj.dk> - 2012-12-23 00:50 +0000
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-21 08:39 +0000
Re: Need clarification on Object.equals. Gene Wirchenko <genew@telus.net> - 2012-12-20 13:39 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-21 08:34 +0000
Re: Need clarification on Object.equals. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-19 09:22 -0600
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 15:35 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 10:56 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 17:08 +0000
Re: Need clarification on Object.equals. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-19 08:58 -0600
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 15:32 +0000
Re: Need clarification on Object.equals. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-19 11:08 -0600
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 17:32 +0000
Re: Need clarification on Object.equals. Lars Enderin <lars.enderin@telia.com> - 2012-12-19 18:41 +0100
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 17:58 +0000
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 18:12 +0000
Re: Need clarification on Object.equals. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-19 12:29 -0600
Re: Need clarification on Object.equals. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-19 12:00 -0600
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 18:06 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 13:13 -0500
Re: Need clarification on Object.equals. Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-19 07:48 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 16:48 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 12:09 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 17:50 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 13:14 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 18:59 +0000
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 13:16 -0500
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 19:05 +0000
Re: Need clarification on Object.equals. Gene Wirchenko <genew@telus.net> - 2012-12-19 11:45 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 20:00 +0000
Re: Need clarification on Object.equals. Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-19 17:15 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-20 09:22 +0000
Re: Need clarification on Object.equals. Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-12-20 07:36 -0800
Re: Need clarification on Object.equals. Gene Wirchenko <genew@telus.net> - 2012-12-19 10:19 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-19 19:16 +0000
Re: Need clarification on Object.equals. Gene Wirchenko <genew@telus.net> - 2012-12-19 11:48 -0800
Re: Need clarification on Object.equals. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-12-19 14:12 -0600
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 09:04 -0500
Re: Need clarification on Object.equals. Lew <lewbloch@gmail.com> - 2012-12-19 13:40 -0800
Re: Need clarification on Object.equals. lipska the kat <lipskathekat@yahoo.co.uk> - 2012-12-20 09:30 +0000
Re: Need clarification on Object.equals. Lew <lewbloch@gmail.com> - 2012-12-18 12:52 -0800
Re: Need clarification on Object.equals. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-12-19 09:27 -0600
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-19 10:44 -0500
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 22:11 -0500
Re: Need clarification on Object.equals. Arne Vajhøj <arne@vajhoej.dk> - 2012-12-18 22:10 -0500
csiph-web