I currently have an array list named list that contains lots of numbers (doubles). I need to split this big array list into 8 smaller ones and I do this by:
//Array List "list" contains close to 8 million numbers in it
for (int c1 = 0; c1 < list.size(); c1++)
{ //for
counter1++;
if (counter1 % rows ==1)
ID.add(list.get(c1));
else if (counter1 % rows ==2)
Contract.add(list.get(c1));
else if (counter1 % rows == 3)
Date.add(list.get(c1));
else if (counter1 % rows == 4)
Open.add(list.get(c1));
else if (counter1 % rows == 5)
High.add(list.get(c1));
else if (counter1 % rows == 6)
Low.add(list.get(c1));
else if (counter1 % rows == 7)
Close.add(list.get(c1));
else if (counter1 % rows == 8)
Volume.add(list.get(c1));
} //for
Every 8th number is the start of a new line of important information.
eg.
ID Contract Date Open High Low Close Volume
ID1 Contract1 Date1 Open1 High1 Low1 Close1 Volume1
Before i asked if there was a better way to organize this. I now have a DIFFERENT question. Is there a way to search an arraylist outside of using a for loop? instead of organizing the array list like I have (it takes forever with large documents), can I promp a user to enter an ID and Contract and then have my program search for that in the code in a more efficient manner than using a for loop?