Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8869
| From | dhtml <dhtmlkitchen@gmail.com> |
|---|---|
| Newsgroups | comp.lang.javascript, comp.lang.java.programmer |
| Subject | Re: Objects comparaison ? |
| Date | 2011-10-16 09:05 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <b2196b98-93ac-49fc-bca5-61ae8fafee24@r2g2000prh.googlegroups.com> (permalink) |
| References | (6 earlier) <2326223.jLKWLtnpvF@PointedEars.de> <e0b407d3-9663-4c23-9863-5969374eaa2d@e37g2000yqa.googlegroups.com> <2065619.34vx2sxqLb@PointedEars.de> <d66a4e0d-c27d-4fcf-9e1d-74e15613d52a@t38g2000prg.googlegroups.com> <2995463.SPkdTlGXAF@PointedEars.de> |
Cross-posted to 2 groups.
On Oct 16, 2:41 am, Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote: > dhtml wrote: > > Thomas 'PointedEars' Lahn wrote: > >> dhtml wrote: > >> > Thomas 'PointedEars' Lahn wrote: > >> >> dhtml wrote: > >> >> > Thomas 'PointedEars' Lahn wrote: > >> >> >> Jukka K. Korpela wrote: > >> >> >> > 13.10.2011 22:21, Thomas 'PointedEars' Lahn wrote: > >> >> >> >> Java's equals() method [– which exists precisely for that > >> >> >> >> purpose – should provide a good start for an implementation in > >> >> >> >> ECMAScript.] > > >> >> > Java `Object.equals` does nothing more than use Java's == which is > >> >> > analagous to JavaScript's ===. > > >> >> I did not write `Object.equals()', if you cared to notice. > > >> > Which Java equals() method did you mean? > > >> Context matters. By "should provide a good *start* for an implementation > >> *in* ECMAScript" I was referring to the *concept* of Java's > >> Object.equals() method, a method which is *overriden* by subclasses. > > > Not necessarily. > > Most definitely it is. There is String.equals() and, say, Boolean.equals(). > Both are subclasses of Object and override Object.equals(). > And there is also java.lang CharSequence and StringBuffer, which do not. And also: > > Object `equals` method may be overridden but this is often neglected by > > programmers. Java guidelines for how to override `equals` are applicable > > here. > > ACK > So there really isn't a Java equals method that applies to the OP. There is Java's guidelines though, to be reflexive, symmetric, transitive, and consistent. An `equals` method should also have no observable side effects. -- Garrett
Back to comp.lang.java.programmer | Previous | Next | Find similar
Re: Objects comparaison ? dhtml <dhtmlkitchen@gmail.com> - 2011-10-16 09:05 -0700
csiph-web