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