I need to compare 2 words in a given name and see if any part of the name in index [0] (first name and/or surname) matches the rest of the names. For instance,

robert smith | robert mathews | john robert | john roberts

Basically, only the first and lastname in the first index ("robert smith") needs to be compared with rest of the first and the last names. '

How do I go about this?

I'm successful in comparing just 1 word. eg: robert|RoBERT|smith
boolean result1= choiceKeys[0].equalsIgnoreCase (choiceKeys[i+1]);

What should I do when I have 2 words?

Thanks in advance,