Find Number Of Same Elements In An TArray

Hey all.
I want to find how many of a some certain element in an array: (I have an inventory system and want to find how many of a same item in the inventory)
How to do that ? I looked at docs but couldn’t find a function that returns number of specified same element. I thought there would be something like Array.FindNum() that already exists. Do I have to iterate or something similar ?
Thanks.

Hello,

You must create a function who return the number of items by class in yout inventory class like this:

Class::GetAmountByClass(TSubclassOf<class UObject>  MyClassType)
 uint64 amount = 0;
{
    for( UItem* item: Items){
          if(item->getClass()==MyClassType)
          amount++;
     }
return amount;
}

Note: this is only a code sample.

You need to modify some things depending of your goals

Thanks. After looking at some other posts and comparing with yours I came up with below which works just fine.
Thank you very much

	for (int i = 0; i < Inventory.Num() - 1; i++)
	{

		FInventoryItem CheckedSlot = Inventory[i];
		if (CheckedSlot == *EmptyInventorySlot)
		{
			AmountOfEmptySlots++;
		}
	}