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