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