Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #16176
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How to not use casting to invoke the methods of a List of objects |
| Date | 2012-07-20 21:22 -0700 |
| Organization | Canadian Mind Products |
| Message-ID | <9hbk0892evf5rhp3p0verr6qhq8g447823@4ax.com> (permalink) |
| References | <61dca380-4364-4713-aa27-e885f96632ea@googlegroups.com> |
On Fri, 20 Jul 2012 06:58:49 -0700 (PDT), clusardi2k@aol.com wrote, quoted or indirectly quoted someone who said : >Below uses a List of objects of class Route. Class Route has public member = >variables (such as locationid) and public methods (such as get_locationid()= >). The below code is a first attempt at a way to obtain the value of locati= >onid using casting. Question: What is the code to do it a better way. see http://mindprod.com/jgloss/generics.html Generics let you tell the compiler what types you are hiding in your collections so it can do the casting for you. -- Roedy Green Canadian Mind Products http://mindprod.com The greatest shortcoming of the human race is our inability to understand the exponential function. ~ Dr. Albert A. Bartlett (born: 1923-03-21 age: 89) http://www.youtube.com/watch?v=F-QA2rkpBSY
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to not use casting to invoke the methods of a List of objects clusardi2k@aol.com - 2012-07-20 06:58 -0700
Re: How to not use casting to invoke the methods of a List of objects markspace <-@.> - 2012-07-20 07:21 -0700
Re: How to not use casting to invoke the methods of a List of objects clusardi2k@aol.com - 2012-07-20 08:09 -0700
Re: How to not use casting to invoke the methods of a List of objects Joerg Meier <joergmmeier@arcor.de> - 2012-07-20 17:45 +0200
Re: How to not use casting to invoke the methods of a List of objects Robert Klemme <shortcutter@googlemail.com> - 2012-07-20 18:03 +0200
Re: How to not use casting to invoke the methods of a List of objects Joerg Meier <joergmmeier@arcor.de> - 2012-07-20 18:59 +0200
Re: How to not use casting to invoke the methods of a List of objects Roedy Green <see_website@mindprod.com.invalid> - 2012-07-20 21:22 -0700
Re: How to not use casting to invoke the methods of a List of objects Lew <noone@lewscanon.com> - 2012-07-21 23:34 -0700
csiph-web