Code example for WeakHashMap

Methods: get, put

0
 
    /** 
     * Get thread status and create one if specified. 
     */ 
    private synchronized ThreadStatus getOrCreateThreadStatus(Thread t) {
        ThreadStatus status = mThreadStatus.get(t);
        if (status == null) {
            status = new ThreadStatus();
            mThreadStatus.put(t, status);
        } 
        return status;
    } 
 
    /** 
     * The following three methods are used to keep track of 
     * BitmapFaction.Options used for decoding and cancelling. 
     */ 
    private synchronized void setDecodingOptions(Thread t,
            BitmapFactory.Options options) {
        getOrCreateThreadStatus(t).mOptions = options;
    }