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