mysql - How can I sort excel file by the first column? java -
i have make program read data excel files 1 here 
, store them in table in mysql descending id. have made program read data , print them in console using apache poi, create table first row of excel file , store rest data. storing happen ids. made function first read first column ids , read rest data using linkedhashmap.
how sorting in ids?could me? have put spaces think changes should made.
add each tablerow list. use collections sort() method sort data , iterate through , insert.
you can customize compareto() determine order.
@override public int compareto(tablerow o) { // descending order return this.getid().compareto(o.getid())*(-1); } using comparator, can :
new comparator<tablerow>() { @override public int compare(tablerow o1, tablerow o2) { // descending order return o1.getid().compareto(o.getid())*(-1); } }
Comments
Post a Comment