0
public static ArrayList<String> getGenreNames()
{
    for (int i=0; i < questions.size(); i++)
    {
        if(questions.get(i).getGenre().equals(""))
        {

        }
    }
}

In this method, I want to grab all genre names that exist in questions. "questions" is a Question that contains "new Question("genre", "question", ArrayofStrings choices, "answer", "Fun Fact")".

What I trying to do is to grab the names of the genres, but only when they're detected once until the methods sees another genre that has not been seen before.

Example: ArrayListOfStrings allGenres = {"Video Games", "Animals", "Music", ...};

I'm assuming that a for loop would be a good way to start but I'm unsure of how to grab those genre without having multiples of the same genre name. That's why there isn't much written besides the for loop.

How can I preform that kind of method?

0 Answers0