0
Hello, I have the following problem I have an Arraylist that returns several small arrays of two positions
String[] temp = new String[2];
and has the saved arrayList adds several "temp";
ArrayList lista = new ArrayList();
while(rs.next()){
if(rs.getString("texto") != null){
temp[0] = String.valueOf(rs.getInt("id"));
temp[1] = rs.getString("texto");
lista.add(temp);
}else{
temp[0] = String.valueOf(rs.getInt("id"));
temp[1] = rs.getString("valor");
}
}
Good the temp[0]
contains the ID of a table my challenge and take from within the Arraylist the values and groups through the position of the ID, so would be only a few arrays like the array tempx[]
contains all the temp[1]
that has temp[0]
with the same value. Which then goes to another Array List
Like something like that
enquanto lista.get(a).temp[0] conter o mesmo identificador faça
tempx[i] = lista.get(i).temp[1]
i++;
Quando o lista.get(a).temp[0] mudar então um novo arrayList deve receber essa nova array.
listaAtualizada.add(tempx);
I’m not very good at ideas today and I’m struggling to do it.