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