Code example for SparseArray

Methods: getindexOfKeyput

0
    private boolean matchOrUpdateInstance() { 
        int currentSelectorCounter = 0;
        int currentSelectorInstance = 0;
 
        // matched attributes - now check for matching instance number 
        if(mSelectorAttributes.indexOfKey(UiSelector.SELECTOR_INSTANCE) > 0) {
            currentSelectorInstance =
                    (Integer)mSelectorAttributes.get(UiSelector.SELECTOR_INSTANCE);
        } 
 
        // instance is required. Add count if not already counting 
        if(mSelectorAttributes.indexOfKey(UiSelector.SELECTOR_COUNT) > 0) {
            currentSelectorCounter = (Integer)mSelectorAttributes.get(UiSelector.SELECTOR_COUNT);
        } 
 
        // Verify 
        if (currentSelectorInstance == currentSelectorCounter) {
            return true; 
        } 
        // Update count 
        if (currentSelectorInstance > currentSelectorCounter) {
            mSelectorAttributes.put(UiSelector.SELECTOR_COUNT, ++currentSelectorCounter);
        } 
        return false; 
    } 
 
    /** 
Contextual code suggestions in your IDE  Get Codota for Java