Code example for ConcurrentMap

Methods: get, put

0
		this.imageResourceStore = imageResourceStore;
		this.downloadingDrawable = downloadingDrawable;
	} 
 
	public Drawable get(K key) {
		Drawable memoryCachedDrawable = memoryImageCache.get(key);
		if (memoryCachedDrawable != null) {
			return memoryCachedDrawable;
		} 
 
		ImageResourceType storedResource = imageResourceStore.get(key);
		if (storedResource != null) {
			return convertAndCache(key, storedResource);
		} 
 
		//Drawable downloadingDrawable2 = downloadingDrawable(); 
		AsyncLoadDrawable asyncLoadDrawable = new AsyncLoadDrawable();
		asyncLoadDrawable.setDelegate(downloadingDrawable);
 
		asyncDownloaders.get(key).register(asyncLoadDrawable);
		return asyncLoadDrawable;
	} 
// 
//	private Drawable downloadingDrawable() { 
//		Bitmap bm = Bitmap.createBitmap(56, 56, Bitmap.Config.ARGB_8888); 
//		Canvas c = new Canvas(bm); 
//		Paint paint = new Paint(); 
//		paint.setColor(0x88888888); 
//		c.drawCircle(0, 0, 25, paint); 
//		 
//		return new BitmapDrawable(bm); 
//	} 
 
	private Drawable convertAndCache(K key, ImageResourceType storedResource) {
		Drawable drawable = imageProcessor.convert(storedResource);
		memoryImageCache.put(key, drawable);
		return drawable;
	} 
 
	class AsyncImageDownloaderTask extends AsyncTask<Void, Void, Drawable> {