FileDocCategorySizeDatePackage
ArrayListTest.javaAPI DocAndroid 1.5 API8990Wed May 06 22:42:02 BST 2009com.android.unit_tests

ArrayListTest

public class ArrayListTest extends android.test.PerformanceTestBase

Fields Summary
private ArrayList
mList
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();

        mList = new ArrayList();
        mList.add(0);
        mList.add(1);
        mList.add(2);
        mList.add(3);
        mList.add(4);
        mList.add(5);
        mList.add(6);
        mList.add(7);
        mList.add(8);
        mList.add(9);
    
public voidtestArrayListAdd()

        int i = 0;
        for (; i < 10; i++) {
            mList.add(i);
            mList.add(i);
            mList.add(i);
            mList.add(i);
            mList.add(i);
            mList.add(i);
            mList.add(i);
            mList.add(i);
            mList.add(i);
            mList.add(i);
        }
    
public voidtestArrayListAdd1()

        int i = 0;
        for (; i < 10; i++) {
            mList.add(7, i);
            mList.add(7, i);
            mList.add(7, i);
            mList.add(7, i);
            mList.add(7, i);
            mList.add(7, i);
            mList.add(7, i);
            mList.add(7, i);
            mList.add(7, i);
            mList.add(7, i);
        }
    
public voidtestArrayListAddAll()

        ArrayList<Integer> aList = new ArrayList();

        int i = 0;
        boolean b;
        for (; i < 10; i++) {
            b = aList.addAll(mList);
            b = aList.addAll(mList);
            b = aList.addAll(mList);
            b = aList.addAll(mList);
            b = aList.addAll(mList);
            b = aList.addAll(mList);
            b = aList.addAll(mList);
            b = aList.addAll(mList);
            b = aList.addAll(mList);
            b = aList.addAll(mList);

        }
    
public voidtestArrayListAddAll1()

        ArrayList<Integer> aList = new ArrayList();

        int i = 0;
        boolean b;

        for (; i < 10; i++) {
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
            b = aList.addAll(0, mList);
        }
    
public voidtestArrayListClone()

        Object rObj;
        int i = 0;

        for (; i < 100; i++) {
            rObj = mList.clone();
            rObj = mList.clone();
            rObj = mList.clone();
            rObj = mList.clone();
            rObj = mList.clone();
            rObj = mList.clone();
            rObj = mList.clone();
            rObj = mList.clone();
            rObj = mList.clone();
            rObj = mList.clone();
        }
    
public voidtestArrayListContains()

        boolean flag;
        int i = 0;

        for (; i < 100; i++) {
            flag = mList.contains(i);
            flag = mList.contains(i);
            flag = mList.contains(i);
            flag = mList.contains(i);
            flag = mList.contains(i);
            flag = mList.contains(i);
            flag = mList.contains(i);
            flag = mList.contains(i);
            flag = mList.contains(i);
            flag = mList.contains(i);

        }
    
public voidtestArrayListGet()

        int i = 0, value;
        int len = mList.size();
        for (; i < len; i++) {
            value = mList.get(i);
            value = mList.get(i);
            value = mList.get(i);
            value = mList.get(i);
            value = mList.get(i);
            value = mList.get(i);
            value = mList.get(i);
            value = mList.get(i);
            value = mList.get(i);
            value = mList.get(i);
        }
    
public voidtestArrayListIndexOf()

        int i = 0, index;

        for (; i < 100; i++) {
            index = mList.indexOf(0);
            index = mList.indexOf(0);
            index = mList.indexOf(0);
            index = mList.indexOf(0);
            index = mList.indexOf(0);
            index = mList.indexOf(0);
            index = mList.indexOf(0);
            index = mList.indexOf(0);
            index = mList.indexOf(0);
            index = mList.indexOf(0);
        }
    
public voidtestArrayListLastIndexOf()

        int i = 0, index;

        for (; i < 100; i++) {
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
            index = mList.lastIndexOf(0);
        }
    
public voidtestArrayListRemove()

        ArrayList<Integer> aList;
        aList = new ArrayList();
        for (int j = 0; j < 10000; j++) {
            aList.add(0);
        }

        int i = 0, index;

        for (; i < 10; i++) {
            index = aList.remove(0);
            index = aList.remove(0);
            index = aList.remove(0);
            index = aList.remove(0);
            index = aList.remove(0);
            index = aList.remove(0);
            index = aList.remove(0);
            index = aList.remove(0);
            index = aList.remove(0);
            index = aList.remove(0);


        }
    
public voidtestArrayListRemove1()

        ArrayList<String> aList;
        String s;

        aList = new ArrayList();
        for (int j = 0; j < 100; j++) {
            aList.add("a");
            aList.add("b");
        }
        s = new String("a");

        int i = 0;
        boolean b;
        for (; i < 10; i++) {
            b = aList.remove(s);
            b = aList.remove(s);
            b = aList.remove(s);
            b = aList.remove(s);
            b = aList.remove(s);
            b = aList.remove(s);
            b = aList.remove(s);
            b = aList.remove(s);
            b = aList.remove(s);
            b = aList.remove(s);
        }
    
public voidtestArrayListSet()

        int i = 0;
        for (; i < 10; i++) {
            mList.set(5, 0);
            mList.set(5, 0);
            mList.set(5, 0);
            mList.set(5, 0);
            mList.set(5, 0);
            mList.set(5, 0);
            mList.set(5, 0);
            mList.set(5, 0);
            mList.set(5, 0);
            mList.set(5, 0);
        }
    
public voidtestArrayListSize()

        int i = 0, len;
        for (; i < 100; i++) {
            len = mList.size();
            len = mList.size();
            len = mList.size();
            len = mList.size();
            len = mList.size();
            len = mList.size();
            len = mList.size();
            len = mList.size();
            len = mList.size();
            len = mList.size();
        }
    
public voidtestArrayListToArray()

        Object rArray;
        int i = 0;
        for (; i < 100; i++) {
            rArray = mList.toArray();
            rArray = mList.toArray();
            rArray = mList.toArray();
            rArray = mList.toArray();
            rArray = mList.toArray();
            rArray = mList.toArray();
            rArray = mList.toArray();
            rArray = mList.toArray();
            rArray = mList.toArray();
            rArray = mList.toArray();
        }
    
public voidtestArrayListToArray1()

        Integer[] rArray = new Integer[10];

        Integer[] mArray;
        int i = 0;
        for (; i < 100; i++) {
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
            mArray = mList.toArray(rArray);
        }