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