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