I have a method that is used to compare parameter types to the types of arguments given.
private boolean typesMatch(Class<?>[] one, Object[] two)
{
if(one.length != two.length)
return false;
for (int i = 0; (i < one.length)&&(i < two.length); i++)
if(!one[i].equals(two[i].getClass()))
return false;
return true;
}
For example, in one[], there might be String, boolean
. However, in the second, there is String, Boolean
. Do you see my issue? When it compares boolean and Boolean it returns false. How do I solve this so that I don't have to use 'if statements' for every primitive type to unwrap them?
Edit: I mean to unwrap the wrapper class in the second array so it's comparable to the primitive type in the first array.
Originally, the Boolean object in array two was added to it as primitive boolean.