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