Code example for SparseArray

0
    private static final int SIGNATURE_HASH_XBOX360_WIRELESS = -412618953;
    private static final int SIGNATURE_HASH_PS3 = -528816963;
    private static final int SIGNATURE_HASH_NYKO_PLAYPAD = 1245841466;
    private static final int SIGNATURE_HASH_LOGITECH_WINGMAN_RUMBLEPAD = 1247256123;
     
    private static final SparseArray<AxisMap> sAllMaps = new SparseArray<AxisMap>();
    private final String mSignature;
     
    public static AxisMap getMap( InputDevice device )
    { 
        if( device == null )
            return null; 
         
        int id = device.hashCode();
        AxisMap map = sAllMaps.get( id );
        if( map == null )
        { 
            // Add an entry to the map if not found 
            Log.v( "AxisMap", "Auto-classifying " + device.getName() );
            map = new AxisMap( device );
            sAllMaps.put( id, map );