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