我试图让它根据包含某个输入字符串的数组条目返回一定数量的数组条目。
/**
* This method returns a list of all words from
* the dictionary that include the given substring.
*/
public ArrayList<String> wordsContaining(String text)
{
    ArrayList<String> contentCheck = new ArrayList<String>();
    for(int index = 0; index < words.size(); index++)
    {
        if(words.contains(text))
        {
            contentCheck.add(words.get(index));
        }
    }
    return contentCheck;
}
我不明白为什么这会不断返回数组中的每个值,而不仅仅是包含字符串位的条目。谢谢!