Question

I have a problem with setting SortKeys in java. I used a SortKey from an existing JTable and set it to another one, but somehow it is not working when there are duplicate values in a column, for example the values 1, 2, 3, 4, 5 are sorted correctly, but the values 1, 1, 1, 2, 2, 2, 3, 3 differ in the their order in the JTable.

PS: I already have setMaxSortKeys(int max) on 1.

Was it helpful?

Solution

It is possible that initial ordering of the rows is different in two tables. It is also possible that the sorting algorithm used to sort the tables is not stable. In these cases you can't expect the order to be same for duplicate column values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top