• 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

how can i pull out every number from a vector

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello there i have this arraylist (arr2) with the values 1, 2, 5 and 10 inside it.
the problem is that i want to get each value out one at a time use i each one seperatly in my if statement (if (i%10 == ((Integer)arr2.get(arr2.size()-1)).intValue()) ) and then use the outcome in diffrent parts of my code.
so for example i want to get the number 1 from the arraylist and then use the outcome in another part of my code and then do the same with the number 2.
if anyone can help it would be great
thanks ben

 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what you are asking here. In particular, what result do you want to use else where? And where do you want to use it? Your if statement is so complex that it will probably help if you broke it down.
 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello layne
well when i use the if statement it gets the number 1 from the arraylist (arr2) and that pulls out the 1, 11, 21, 31 words from the vector. which it does ok.
but then i need to change the int value to value that is next in the arraylist (arr2), and so on with the next value from the arraylist untill i have used all the values from the arraylist.
thanks
ben
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The code above looks a lot like the code in your question on the intermediate message board. I suggest that we focus on one issue at a time here. Let's just continue this discussion in that other thread.
Regards,
Layne
reply
    Bookmark Topic Watch Topic
  • New Topic