This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can i pull out every number from a vector

 
ben riches
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • 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

 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic