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