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