I am goint to write a method, say public static JTable getJTableFromArrayList(ArrayList list), that can easily build a JTable from ArrayList to compare various of datas. This ArrayList is supposed to held any type of Object.
What I can come up with now is to use Gson.
Use
Gson.toJsonTree(Object src)method to parse theArrayList<T> srcinto aJsonElement.Build
JsonObject[]from theJsonElementUse
JsonObject.entrySet()to get aSet<Map.Entry<String,JsonElement>>Then build the
JTablefrom a self-definedAbstractTableModel, while the row s and columns and titles are got from theSet.
Before I start it, I want to know if there is a simpler and more direct way to do this rather than play with Gson? And also, if others have accomplished this already, I would be glad to use ready-made tools.