Using Java, which is the best way to combine two class arrays based on some class value?
Example. We have these two classes:
public class C1{
public String id="";
public String value="";
public String tot="";
}
public Class C2{
public String id="";
public String tot="";
}
And at some point in our code, we have two arrays like:
C1 a [] = { {"1","value#1",""},
{"2","value#2",""},
{"3","value#3",""},
{"4","value#4",""}
};
C2 b [] = { {"1","2"},
{"2","11"},
{"4","15"}
};
The final array should look like this:
C1 f [] = { {"1","value#1","2"},
{"2","value#2","11"},
{"3","value#3",""},
{"4","value#4","15"}
};
I am trying to find the best way to achieve this result without reading an array from beginning to end, because here two arrays have only a few lines, but in fact they both can have a length of 100 to + ...