Package org.mapdb

Source Code of org.mapdb.Issue308Test

package org.mapdb;

import org.junit.Test;

import java.util.Iterator;
import java.util.concurrent.atomic.AtomicLong;

public class Issue308Test {

    @Test
    public void test() {
        DB db = DBMaker.newTempFileDB()
                .mmapFileEnableIfSupported()
                .compressionEnable()
                .transactionDisable()
                .checksumEnable()
                .commitFileSyncDisable()
                .make();
        Iterator<Fun.Pair<Long, String>> newIterator = new Iterator<Fun.Pair<Long, String>>() {
            private AtomicLong value = new AtomicLong(10000000);

            @Override
            public boolean hasNext() {
                return value.get() > 0;
            }

            @Override
            public Fun.Pair<Long, String> next() {
                Long v = value.decrementAndGet();
                return new Fun.Pair<Long, String>(v, v.toString());
            }

            @Override
            public void remove() {

            }
        };
        BTreeMap<Long, String> cubeData = db.createTreeMap("data").pumpSource(newIterator).make();
    }
}
TOP

Related Classes of org.mapdb.Issue308Test

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.