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