ShadowSparseIntArray.java revision 22622b702449484618cf0d66f8a97849c48d4b36
1package com.xtremelabs.robolectric.shadows; 2 3import android.util.SparseArray; 4import android.util.SparseIntArray; 5 6import com.xtremelabs.robolectric.internal.Implementation; 7import com.xtremelabs.robolectric.internal.Implements; 8import com.xtremelabs.robolectric.internal.RealObject; 9 10@Implements(SparseIntArray.class) 11public class ShadowSparseIntArray { 12 13 private SparseArray<Integer> sparseArray = new SparseArray<Integer>(); 14 15 @RealObject 16 private SparseIntArray realObject; 17 18 @Implementation 19 public int get( int key ){ 20 return sparseArray.get( key ); 21 } 22 23 @Implementation 24 public int get(int key, int valueIfKeyNotFound){ 25 return sparseArray.get( key, valueIfKeyNotFound ); 26 } 27 28 @Implementation 29 public void put( int key, int value ){ 30 sparseArray.put( key, value ); 31 } 32 33 @Implementation 34 public int size() { 35 return sparseArray.size(); 36 } 37 38 @Implementation 39 public int indexOfValue( int value ) { 40 return sparseArray.indexOfValue( value ); 41 } 42 43 @Implementation 44 public int keyAt( int index ){ 45 return sparseArray.keyAt( index ); 46 } 47} 48