Code example for ConcurrentHashMap

0
    private boolean diskCacheEnabled = false;
    private ExecutorService writeThread;
 
    public WebImageCache(Context context) {
        // Set up in-memory cache store 
        memoryCache = new ConcurrentHashMap<String, SoftReference<Bitmap>>();
 
        // Set up disk cache store 
        Context appContext = context.getApplicationContext();
        diskCachePath = appContext.getCacheDir().getAbsolutePath() + DISK_CACHE_PATH;
 
        File outFile = new File(diskCachePath);
        outFile.mkdirs();
 
        diskCacheEnabled = outFile.exists();
 
        // Set up threadpool for image fetching tasks 
        writeThread = Executors.newSingleThreadExecutor();
    } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE