Let's say you have a string array arr with 3 strings in it. To compare its values, you would simply do the following:
if (arr[0].equals(arr[1]) && arr[0].equals(arr[2] && arr[1].equals(arr[2]) {
return true;
}
But what if that array had hundreds of strings? What is the best way to compare all the values?
I thought of using for loops but Java does not allow loops inside a conditional. Any ideas?