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