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