ICU-8268 impossible cast from double[] to int[].

Java doesn't allow casting array of type A to array of type B. The elements
have to be manually casted.

X-SVN-Rev: 30723
This commit is contained in:
Abhinav Gupta 2011-09-27 19:49:59 +00:00
parent 2fe1f01851
commit b58534a609

View File

@ -77,8 +77,13 @@ public final class Utility {
return(arrayEquals((Object[]) source,target));
if (source instanceof int[])
return(arrayEquals((int[]) source,target));
if (source instanceof double[])
return(arrayEquals((int[]) source,target));
if (source instanceof double[]) {
double[] oldSource = (double[]) source;
int[] newSource = new int[oldSource.length];
for (int i = 0; i < oldSource.length; i++)
newSource[i] = (int)oldSource[i];
return arrayEquals(newSource, target);
}
if (source instanceof byte[])
return(arrayEquals((byte[]) source,target));
return source.equals(target);