Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package examples;
 import java.util.Map;

Opens maps backed by file in temporary folder. Quick and simple way to get Maps which can handle billions of items. All files are deleted after Map is closed or JVM exits (using shutdown hook).
public class _TempMap {
    public static void main(String[] args) {
        // open new empty map
        // DBMaker will create files in temporary folder and opens it
        Map<StringStringmap = DBMaker.newTempTreeMap();
        //put some stuff into map
        //all data are stored in file in temp folder
        // Close map to release resources.
        // It is optional, there is JVM shutdown hook which deletes files on JVM exit.
        // After JVM exits files are deleted.
        // This map was temporary, there is no way to recover its data !
New to GrepCode? Check out our FAQ X