I am not sure if this is possible in java, and know how to code this if this is not possible. However if there is a quicker/more compact way to do this please help me find it.
Allow me to explain what I am doing. I have 20 movies genres (currently just set up as 20 int variables). I also am loading in a bunch of strings, if the string contains a genre (aka if it has "Action") I do action++
However this would require 20 if statments, one for each genre. such as:
if(myString.contains("Action")
action++;
Was wondering if there was more generic way to do this like this:
if(myString.contains(T)
t++;
Where T is my genre list.
Is this possible in java?