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

HashMapTest

public class HashMapTest extends android.test.PerformanceTestBase

Fields Summary
public static final int
ITERATIONS
public HashMap
mMap
public String[]
mKeys
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        mMap = new HashMap();
        mKeys = new String[ITERATIONS];

        for (int i = ITERATIONS - 1; i >= 0; i--) {
            mKeys[i] = Integer.toString(i, 16);
            mMap.put(mKeys[i], i);
        }
    
public intstartPerformance(PerformanceTestCase.Intermediates intermediates)

        intermediates.setInternalIterations(ITERATIONS);
        return 0;
    
public voidtestHashMapClone()

        HashMap cMap;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
            cMap = (HashMap) mMap.clone();
        }
    
public voidtestHashMapContainsValue()

        boolean flag;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);
            flag = mMap.containsValue(i);


        }
    
public voidtestHashMapEntrySet()

        Set keyset;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();
            keyset = mMap.entrySet();


        }
    
public voidtestHashMapGet()

        int num;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
            num = (Integer) mMap.get(mKeys[i]);
        }
    
public voidtestHashMapKeySet()

        Set keyset;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            keyset = mMap.keySet();
            keyset = mMap.keySet();
            keyset = mMap.keySet();
            keyset = mMap.keySet();
            keyset = mMap.keySet();
            keyset = mMap.keySet();
            keyset = mMap.keySet();
            keyset = mMap.keySet();
            keyset = mMap.keySet();
            keyset = mMap.keySet();
        }
    
public voidtestHashMapRemove()

        for (int i = ITERATIONS - 1; i >= 0; i--) {
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
            mMap.remove(mKeys[i]);
        }
    
public voidtestHashMapSize()

        int len;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            len = mMap.size();
            len = mMap.size();
            len = mMap.size();
            len = mMap.size();
            len = mMap.size();
            len = mMap.size();
            len = mMap.size();
            len = mMap.size();
            len = mMap.size();
            len = mMap.size();


        }
    
public voidtestHashMapValues()

        Collection c;
        for (int i = ITERATIONS - 1; i >= 0; i--) {
            c = mMap.values();
            c = mMap.values();
            c = mMap.values();
            c = mMap.values();
            c = mMap.values();
            c = mMap.values();
            c = mMap.values();
            c = mMap.values();
            c = mMap.values();
            c = mMap.values();


        }