• Post Reply Bookmark Topic Watch Topic
  • New Topic

Arrays in ArrayList iteration  RSS feed

 
Greg Burg
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble understanding how to manipulate data from a set of arrays stored in a String arraylist. The data I want to show is in index 2 (column 3) of the arraylist. I want to iterate through the entire arraylist and remove every array in which a value is stored in the second index is less than 10. I got the data from a csv file and it is correctly parsed into the array by line. I need to be able to cast to double or float here because the actual data is currency related (I know theres better types to use for currency but this is for school so its not really necessary.) Here is what I have in my main method so far. I just cant figure out the next step.





Thanks,
Greg
 
Bert Wilkinson
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not too familiar with the parser that you're using, but assuming that the code you have worked correctly and you filled your array list with the String[]'s you are very close!

Now that you've filled the arraylist, your going to have to iterate through it again, test each element of the arraylist and pull out the ones you don't want. Right?

Look at the javadoc for arraylist and you should find the necessary methods to pull out elements.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to JavaRanch
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!