0
Hi, I have a problem and I believe it’s logical, but I can’t find it. I have 4 lists and I have to group the markets of a region, then I have a list with all products linked to the market and I have My list that are the lists of products chosen. I want the name of the market and the sum of the values of if I would make a purchase on it but no market can be compared if I don’t have all the products.
Listas l=Listas.getInstance();
int i =1; //Regiaoo.getIdReg();
List<prodmerc> tempPM = new ArrayList();
List<prodmerc> tempPM1 = new ArrayList();
List<FiltraMercados> fm=new ArrayList();
FiltraMercados ff=new FiltraMercados();
for (int ii=0;ii<l.getM().size();ii++){
for (int j=0;j<l.getMl().size();j++){
for (int jj=0;jj<l.getPm().size();jj++){
if(l.getPm().get(jj).getMercID()==l.getM().get(ii).getMercID() && l.getPm().get(jj).getProdID()==l.getMl().get(j).getP().getProdID() && l.getM().get(ii).getRegID()==i){
FiltraMercados f=new FiltraMercados(l.getM().get(ii),l.getMl().get(j).getP().getProdID(),(l.getPm().get(jj).getPmPreco()*l.getMl().get(j).getQtda()));
fm.add(f);
}
}
}
}
Friend, your code is very complicated to understand. I see several problems, but as it is not possible to leave wanting to fix everything at once, first I advise you to rename the variables to more intuitive names. You can’t tell what each variable is there. After that, we can see if it becomes easier to understand the problem.
– Gabriel Katakura