package at.yawk.numaec;
import org.eclipse.collections.api.map.primitive.IntIntMap;
public final class MutableIntIntBTreeMapFactory implements MutableIntIntBufferMapFactory {
private final LargeByteBufferAllocator allocator;
private final BTreeConfig config;
private MutableIntIntBTreeMapFactory(LargeByteBufferAllocator allocator, BTreeConfig config) {
this.allocator = allocator;
this.config = config;
}
public static MutableIntIntBufferMapFactory withAllocator(LargeByteBufferAllocator allocator) {
return withAllocatorAndConfig(allocator, BTreeConfig.builder().build());
}
public static MutableIntIntBufferMapFactory withAllocatorAndConfig(
LargeByteBufferAllocator allocator, BTreeConfig config
) {
return new MutableIntIntBTreeMapFactory(allocator, config);
}
@Override
public MutableIntIntBufferMap empty() {
return new IntIntBTreeMap.Mutable(allocator, config);
}
@Override
public MutableIntIntBufferMap ofInitialCapacity(int capacity) {
return empty();
}
@Override
public MutableIntIntBufferMap ofAll(IntIntMap map) {
MutableIntIntBufferMap n = ofInitialCapacity(map.size());
n.putAll(map);
return n;
}
}