Simple way to add data to columns
I want to insert two separate datasets to columns in JavaFX TableView. Basically I have 2 LinkedLists with Strings and I want to put one list in one column and another to second one.
What is the easiest way to do this? Or is another JavaFX element better for this?
Only solutions I found so far were based on collections that were inserted into rows, which is not what I want to do.
I would strongly recommend reorganizing your data, so that you have a class with two properties, one of which is an element from your first list, and the other of which is the corresponding element from your second list. Then you can make a list of objects of that class, and you are reduced to the usual case.
E.g. suppose you have
Now you can do
and define the columns in the usual way.
If you really can’t make that data transformation for some reason, then you can regard the type of the table as an integer, with the value for each row being the index into the two lists. Populate the table with the values