What is the best way to iterate all data?

I have 2.6 million rows and I would like to limit 20000 rows each iteration.

Here is simple code:

int limit_size=200000;
int rowCount=getrowCount();
startPoint=0;
endPoint=limit_size;

while
 getData(startPoint,endPoint)
 startPoint=endPoint+1;
 endPoint=endPoint+limit_size

What is the way to iterate all data 0 to 2.6 million?

Answer

for (<DataType> d : data) { ... }

or,

for (int i = 0; i < 2600000; i++) { ... }

where … is the code you are putting within the loop

Leave a Reply

Your email address will not be published. Required fields are marked *