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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top