1

This is part of my code

for (Object o : materia2) {
    String v = o.toString();
    datos = FXCollections.observableArrayList(new Tabla(v));
}

where through a list (List materia2) to convert each element of that list in string, later, full FXCollections.observableArrayList (new Table (v)); where "v" is every string converted, but only the last item in the list is sponds, my question is, as I do so that each element of the list appears correctly.

1 Answer 1

5

Create the list once, and add an element to it each time you iterate through the loop:

datos = FXCollections.observableArrayList();
for (Object o : materia2) {
    String v = o.toString();
    datos.add(new Tabla(v) );
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.