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

From markspace <-@.>
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 07:21 -0700
Organization A noiseless patient Spider
Message-ID <jubpi7$51p$1@dont-email.me> (permalink)
References <61dca380-4364-4713-aa27-e885f96632ea@googlegroups.com>

Show all headers | 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