varargs defined as String... can be accessed like a String[].
But the equals method returns false when comparing 2 String arrays, one passed as varargs and other as String[].
Is there a direct way to test for the equality of content in the two arrays ? For instance using the Arrays.equals
method.
Here, is the example:
public String[] getParams() {
return params;
}
public void testForEquality(String... param) {
if (Arrays.equals(getParams(), param)) {
// do something
}
}