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