java - How to write the data to CSV with dynamic headers and Dynamic Values -
i have requirement export data ui table: i want add data csv file, column headers , data should e dynamic, based on column coming dynamically need add data csv file: my columns in map every time retrieving columns based on boolean value below: list<string> header1 = new arraylist<string>(); (entry<object, boolean> entry : layout.getlayout().entryset()) { if (entry.getvalue() == true) { header1.add(entry.getkey().name() + ","); } } i have object values respective columns , need write data csv file: i have option below write csv for (object object: result.getresults()) { (entry<object, boolean> entry : layout.getlayout().entryset()) { if (entry.getvalue() == true) { if(entry.getkey().name().equalsignorecase("xxxx")) { object.getxxx(); } ...