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