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