I have this function that should merge two array of classes when id
of array1 is equal to id
of array2.
For simplicity I converted one array into an ArrayList so I can remove the occurrence merged into the other one..
I'm looking a way to improve it, also in cpu-time, because the two arrays can have more then 20000rows. The actual way, should take some time..
public Asset[] merge(Asset[] a2, ArrayList<countR> a)
{
while (a.size()!=0){
int i=0;
Boolean b=false;
while (i<a2.length && b==false)
{
if (a.get(0).id.equals(a2[i].id)){
a2[i].TotaleRegistrazioni = a.get(0).tot;
b=true;
}
i++;
}
a.remove(0);
}
return a2;
}