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