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