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


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

Re: Newbee List question

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Newbee List question
Date 2014-02-03 19:39 -0800
Organization Canadian Mind Products
Message-ID <c4o0f9hqaodu14qje9a45uouoi6df2eqa8@4ax.com> (permalink)
References <4bf24581-c504-4225-a584-38b3249e2edc@googlegroups.com>

Show all headers | View raw


On Thu, 9 Jan 2014 04:16:42 -0800 (PST), Todor Atanasov
<xumepoc@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>List groups = new ArrayList();
>List group = null;
>for(int i = 0; i < 20; i++{
>    TestClass test = new TestClass();
>   if(group == null || flag)){
>      group = new ArrayList();
>      groups.add(group);
>   }

Why do you computer test then throw it away?
Where is flag defined?
group will be null only once, your groups.add will be executed only
once. 
group should be declared inside the loop.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Because a thing seems difficult for you, do not think it 
impossible for anyone to accomplish.
~ Marcus Aurelius 121-04-26 180-03-17 

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


Thread

Newbee List question Todor Atanasov <xumepoc@gmail.com> - 2014-01-09 04:16 -0800
  Re: Newbee List question Joerg Meier <joergmmeier@arcor.de> - 2014-01-09 13:38 +0100
  Re: Newbee List question leif.roar@invalid.com (Leif Roar Moldskred) - 2014-01-09 07:50 -0600
    Re: Newbee List question Tim Slattery <tim@risingdove.com> - 2014-01-09 14:12 -0500
      Re: Newbee List question leif.roar@invalid.com (Leif Roar Moldskred) - 2014-01-09 14:41 -0600
  Re: Newbee List question Todor Atanasov <xumepoc@gmail.com> - 2014-01-09 06:52 -0800
  Re: Newbee List question Roedy Green <see_website@mindprod.com.invalid> - 2014-02-03 19:36 -0800
  Re: Newbee List question Roedy Green <see_website@mindprod.com.invalid> - 2014-02-03 19:39 -0800

csiph-web