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