次のように、ループを実行するたびに配列に追加する必要がある5000個の数値を含む「do - while」ループがあります。
問題は、ループが実行されるたびに数値が上書きされ、ループが終了すると、データの最後のランスルーのみが配列にあることです。
私はこのコードを使用します:
long cursor = -1;
long[] fArray = new long[100000]; // more than enough space in array
IDs ids = twitter.getFollowersIDs(name, cursor); // start with first page of 5000 numbers
do
{
ids = twitter.getFollowersIDs(name, cursor);
fArray = twitter.getFollowersIDs(name, cursor).getIDs(); // this gets Array with 5000 numbers every time until "empty"
cursor = ids.getNextCursor(); // jump to next array with 5000 new numbers
} while (ids.hasNext());