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