h2/src/main/org/h2/mvstore/MVStore.java
/**
     * Open a map with the given builder. The map is automatically create if it
     * does not yet exist. If a map with this name is already open, this map is
     * returned.
     *
     * @param <K> the key type
     * @param <V> the value type
     * @param name the name of the map
     * @param builder the map builder
     * @return the map
     */
Open a map with the given builder. The map is automatically create if it
does not yet exist. If a map with this name is already open, this map is
returned.


Open a map with the given builder . The map is automatically create if it does not yet exist . If a map with this name is already open this map is returned .
public synchronized <M extends MVMap<K, V>, K, V> M openMap(String name, MVMap.MapBuilder<M, K, V> builder) {
        checkOpen();
        String x = meta.get("name." + name);
        int id;
        long root;
        HashMap<String, String> c;
        M map;
        if (x != null) {
            id = Integer.parseInt(x);
            @SuppressWarnings("unchecked")
            M old = (M) maps.get(id);
            if (old != null) {
                return old;
            }
            map = builder.create();
            String config = meta.get("map." + x);
            c = DataUtils.parseMap(config);
            c.put("id", x);
            map.init(this, c);
            String r = meta.get("root." + id);
            root = r == null ? 0 : Long.parseLong(r);
        } else {
            c = New.hashMap();
            id = ++lastMapId;
            c.put("id", Integer.toString(id));
            c.put("createVersion", Long.toString(currentVersion));
            map = builder.create();
            map.init(this, c);
            markMetaChanged();
            meta.put("map." + id, map.asString(name));
            meta.put("name." + name, Integer.toString(id));
            root = 0;
        }
        map.setRootPos(root, -1);
        maps.put(id, map);
        return map;
    }
public synchronized < M extends MVMap < K , V > , K , V > M openMap ( String name , MVMap . MapBuilder < M , K , V > builder ) { checkOpen ( ) ; String x = meta . get ( "name." + name ) ; int id ; long root ; HashMap < String , String > c ; M map ; if ( x != null ) { id = Integer . parseInt ( x ) ; @ SuppressWarnings ( "unchecked" ) M old = ( M ) maps . get ( id ) ; if ( old != null ) { return old ; } map = builder . create ( ) ; String config = meta . get ( "map." + x ) ; c = DataUtils . parseMap ( config ) ; c . put ( "id" , x ) ; map . init ( this , c ) ; String r = meta . get ( "root." + id ) ; root = r == null ? 0 : Long . parseLong ( r ) ; } else { c = New . hashMap ( ) ; id = ++ lastMapId ; c . put ( "id" , Integer . toString ( id ) ) ; c . put ( "createVersion" , Long . toString ( currentVersion ) ) ; map = builder . create ( ) ; map . init ( this , c ) ; markMetaChanged ( ) ; meta . put ( "map." + id , map . asString ( name ) ) ; meta . put ( "name." + name , Integer . toString ( id ) ) ; root = 0 ; } map . setRootPos ( root , - 1 ) ; maps . put ( id , map ) ; return map ; }
Open a map with the given builder.
Open a map with the given builder .