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