Filling a TMap with an Array

Hi, i need some basic help with filling a TMap. So i have this simple map and a loop:

TMap<int32, TArray<int32>> map;
int32 randomKey;

for (size_t i = 1; i < 10; i++)
{
    randomKey = FMath::RandRange(1, 3);
	map.Add(randomKey, [i]); //****  pseudoline :)
}

What i want in the end is something like:

map = {
	1 = {1, 8, 3, 4}
	2 = {5, 2}
	3 = {6, 7, 9}
}

so basically, if the given key is present, add the value as an element to the array.
In Java, i can do something simple like

map.get(key).add(value)

How to do this in c++ the easy way? :wink:

Thanks

map.FindOrAdd(key).Add(value);

Or you could just use an array of arrays (rather than a map) if your map keys are linear numbers. It would be better than a map look-up.