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