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


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

Re: How to not use casting to invoke the methods of a List of objects

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: How to not use casting to invoke the methods of a List of objects
Date Fri, 20 Jul 2012 07:21:56 -0700
Organization A noiseless patient Spider
Lines 31
Message-ID <jubpi7$51p$1@dont-email.me> (permalink)
References <61dca380-4364-4713-aa27-e885f96632ea@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Fri, 20 Jul 2012 14:21:59 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="5177"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19KfiFifyafLx0hkni93lhqapbpbTUOEpc="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0
In-Reply-To <61dca380-4364-4713-aa27-e885f96632ea@googlegroups.com>
Cancel-Lock sha1:yWqUTPTMw7VF715/HYuOeotWyPU=
Xref csiph.com comp.lang.java.programmer:16147

Show key headers only | View raw


On 7/20/2012 6:58 AM, clusardi2k@aol.com wrote:

> The
> loop can't even iterate the required number of loops.


You might want to be more clear about what is really failing here. 
Iterator works, so the problem must be somewhere else in the code, which 
you are not showing.


>
 >          Iterator <Route> it = objList.iterator();
 >
 >          int size = objList.size();
 >
 >          for (int i = 0;i < size; i++)
 >          {

Maybe you could try this:

 >             Route r =  it.next();
 >          }


But in general the for-each construct works better

   for( Route r : objList ) {
     r. ...
   }

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


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