Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- class MySafeList extends ArrayList<Double>{
- static ArrayList<Double> mySafeList;
- public boolean add(Double d){
- mySafeList.add(d);
- return true;
- }
- public int size(){
- return mySafeList.size();
- }
- public Double get(int i){
- return mySafeList.get(i);
- }
- static boolean stressTest(int n, int m){
- Thread threads[] = new Thread[n]; //El nombre de tu variable se llama "threads"
- try{
- for(int i=0; i<n; i++){
- threads[i] = new Thread(new ThreadTest(1));
- threads[i].start();
- for(int j=0; j<m;j++){
- Double d = new Double((double) j);
- mySafeList.add(d);
- }
- }
- return true;
- }catch(Exception e){
- return false;
- }
- }
- public static void main(String[] args) {
- MySafeList safeList = new MySafeList();
- stressTest(2,4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement