Code example for WeakHashMap

Methods: getputremove

0
        mSqlitePath = sqlitePath;
    } 
 
    public final synchronized SQLiteDatabase openDatabase() {
 
        SQLiteDatabase db = cache.get(mSqlitePath);
        if (db != null) {
            if (db.isOpen()) {
                return db;
            } 
            cache.remove(mSqlitePath);
        } 
        boolean success = false;
        try { 
            db = SQLiteDatabase.openDatabase(mSqlitePath, null, SQLiteDatabase.CREATE_IF_NECESSARY
                    | SQLiteDatabase.OPEN_READWRITE);
            cache.put(mSqlitePath, db);
            success = true;
            return db;
        } finally { 
            if (!success && db != null) {
                db.close();
Contextual code suggestions in your IDE  Get Codota for Java