Code example for ConcurrentHashMap

Methods: containsKey, get, put

0
     * download image from the internet if there is no cache for the image. 
     *  
     * @param url 
     */ 
    private void downloadImage(String url) {
	if (!mImageMap.containsKey(url) || mImageMap.get(url) == null
		|| mImageMap.get(url).get() == null) {
	    if (!mImageDiskCache.hasCache(url)) {
		HttpUtil.downloadFile(url, mImageDiskCache);
	    } 
	     
	    if (mImageDiskCache.hasCache(url)) {
		Bitmap b = mImageDiskCache.getBitmapFromCache(url);
		if (b != null) {
		    if (!isFinishing() && mImageMap != null) {
			mImageMap.put(url, new SoftReference<Bitmap>(b));
			postUpdateImage(b);
		    } else { 
			b.recycle();
			b = null;
		    }