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