Quote:
I need to use the for-loop because everytime it loops and finds another word that is the same I want to add it to an int variable :
I fear you misunderstood the usage of the for-loop and that you want to use it for the wrong reason.
You need a for-loop because you need to check every element of
RoomType
against a reference word, not because you want to count how many times you encounter the word.
Basically, I see nothing wrong in your code, but without the code around, it is difficult to really tell.
Complete code with a sample of what is in
Roomtype
.