Skip to content

Instantly share code, notes, and snippets.

@anta40
Created September 19, 2022 13:33
Show Gist options
  • Save anta40/9652e4a017e2df47382176e58ef12b1f to your computer and use it in GitHub Desktop.
Save anta40/9652e4a017e2df47382176e58ef12b1f to your computer and use it in GitHub Desktop.
import android.util.Log;
import java.util.ArrayList;
import java.util.Random;
public class BigData {
static int msDataIndex = 0;
int mDataIndex = 0;
String mDataName = "";
ArrayList<String> mList = new ArrayList<String>();
// コンストラクタでは何もしないでおく
public BigData(){
String table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
mDataIndex = msDataIndex++;
mDataName = String.valueOf(table.charAt(mDataIndex % table.length()));
Log.d("test", "...BigData" + mDataName);
}
public void load(){
Log.d("test", "...load" + mDataName);
try{
Random r = new Random();
for(int i = 0; i < 3000; i++){
if(i % 100 == 0){
Log.d("test", "...loading" + mDataName + ":" + i);
}
int n = r.nextInt(10000);
mList.add("item" + mDataName + "_" + n);
Thread.sleep(1);
}
}
catch(InterruptedException ex){
Log.d("test", "======InterruptedException" + mDataName);
}
}
String at(int index){
return mList.get(index) ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment