Very big JTable, RowFilter and extra load

老子叫甜甜 提交于 2019-12-04 05:15:18

问题


I wanted to ask for a clarification about the use of RowFilter and its effects on performances. I implemented a filter through the method include(Entry) that for every row simply checks if its correspondent value in the model has a boolean flag set: if so, returns true, else false.

Now, the JTable I have can be pretty big (1000000+ rows), and I wasn't sure if this simple filtering, applied to such a big input set, could be costly.

How does the mapping between filtered rows and underlying data work exactly? I mean, does it store any extra data or it just draws the rows that match the filter "on the fly"??

Thank you very much for the clarifications.


回答1:


no component in any of programing languages aren't designated to displaying too largiest matrix of data on the screen, then you have two choises

  1. faster way is let's this job for SQL engine, that designated for searching and filtering rows in hugest Database table

  2. slower way is hold these data in HashMap and there apply Comparator, and JTable would be display only result from this Comparator




回答2:


Expanding on @mKorbel's second point, a TableModel for a very large data set may contain a List<Record>, as suggested here. The list may be sorted using a suitable Comparator and dynamically partitioned using the subList() method. At any one time, the corresponding JTable can only see one such partition, and separate controls will be required to change partitions.



来源:https://stackoverflow.com/questions/9067916/very-big-jtable-rowfilter-and-extra-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!