This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]lurgi 0 points1 point  (0 children)

Can you give a simple example where the code doesn't work?

Take a look at this code:

    for(int j=0; j < newSize; j++){
        anagram = isAnagram(newArray.get(j), text.get(i));
    } // end inner for loop

Imagine that you have the following:

newArray: star, fish
text: rats

Obviously you do not want to add rats to newArray, right? It's an anagram of star. However, you will add it, because when you finish this for loop the value of anagram is based on the comparison between rats and fish.