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