• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ArrayList issue

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this test working where it outputs the word "test" based on a calculated result:



Now I would like to stop using the String test (String targetItems = "test"; ) and put real data in using an ArrayList but my attempt outputs a huge array of info for each record:


Please advise how I can get this to work with targetItems ArrayList. Do I need another for loop inside my for loop?
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Did you compile the code that you posted? Because what you posted shouldn't compile.

Henry
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, perhaps it's me, but your post confuses me. You may need to tell more details here.

Also, this is unusual:


as it appears that you're adding a targetItems array list object plus a String(???) plus an int (???). Why?

Does it even compile?
 
Joseph Smithern
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my original that did work with a String test value of "test":

Now I need to use real data which will be coming from the ArrayList targetItems I showed earlier.
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joseph Smithern wrote:Here is my original that did work with a String test value of "test":

Now I need to use real data which will be coming from the ArrayList targetItems I showed earlier.



This code shouldn't compile either. How did you get this to work?

Henry
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please PostRealCode.
 
reply
    Bookmark Topic Watch Topic
  • New Topic