Search code examples
java.util.concurrentmapdb

ConcurrentNavigableMap with MapDB 3.0.5


I'm using the latest version of mapDB (3.0.5) and I have this set of instructions:

DB db = DBMaker.fileDB(new File(FILE_NAME)).closeOnJvmShutdown().make();
ConcurrentNavigableMap<String, Utente> utente = db.getTreeMap("utente");  
if (!utente.keySet().contains("admin")) { 
        Utente user = new Utente("admin", "admin", "", "", "", "", "", "", "", "", "");
        utente.put(user.getUsername(), user);
    }

I got this error on
db.getTreeMap("utente")
"the method getTreeMap(String) is undefined for the type DB."
With an older version of MapDB (1.0.9) this worked fine. I can't understand why. Thanks.


Solution

  • The solution appears to be using the method get() instead of getTreeMap(). Perhaps they changed something in this new version.