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