package at.yawk.numaec;
import org.eclipse.collections.api.factory.map.primitive.MutableDoubleByteMapFactory;
import org.eclipse.collections.api.map.primitive.DoubleByteMap;
public final class MutableDoubleByteLinearHashMapFactory implements MutableDoubleByteBufferMapFactory {
private final LargeByteBufferAllocator allocator;
private final LinearHashMapConfig config;
private MutableDoubleByteLinearHashMapFactory(LargeByteBufferAllocator allocator, LinearHashMapConfig config) {
this.allocator = allocator;
this.config = config;
}
public static MutableDoubleByteMapFactory withAllocator(LargeByteBufferAllocator allocator) {
return withAllocatorAndConfig(allocator, LinearHashMapConfig.builder().build());
}
public static MutableDoubleByteMapFactory withAllocatorAndConfig(
LargeByteBufferAllocator allocator, LinearHashMapConfig config
) {
return new MutableDoubleByteLinearHashMapFactory(allocator, config);
}
@Override
public MutableDoubleByteBufferMap empty() {
return new DoubleByteLinearHashMap.Mutable(allocator, config);
}
@Override
public MutableDoubleByteBufferMap ofInitialCapacity(int capacity) {
DoubleByteLinearHashMap.Mutable map = new DoubleByteLinearHashMap.Mutable(allocator, config);
map.ensureCapacity(capacity);
return map;
}
@Override
public MutableDoubleByteBufferMap ofAll(DoubleByteMap map) {
MutableDoubleByteBufferMap n = ofInitialCapacity(map.size());
n.putAll(map);
return n;
}
}