The FormattedDataSet has such a sort class. It can sort by any number of columns in the array.
<pre> <code>
Object[][] array=...;
ArrayComparator ac=new ArrayComparator();
ac.addSortCol(0,"asc"); // sort by column 0 in ascending order first
ac.addSortCol(1,"desc"); // then by column 1 in descending order
ac.addSortCol(2,"asc"); // then by column 2 in ascending order
ac.sort(array); // note ac can be used to sort as many arrays as needed after it has been created.
// if you only need to sort by 1 column there is a convenience static method
ArrayComparator.sort(array, 2, "asc");
</code> </pre>
http://www.fdsapi.com/javadocs/com/fdsapi/ArrayComparator.html
steve - http://www.fdsapi.com - the easiest way to generate dynamic text including html and xml
Log in to post a comment.
The FormattedDataSet has such a sort class. It can sort by any number of columns in the array.
<pre>
<code>
Object[][] array=...;
ArrayComparator ac=new ArrayComparator();
ac.addSortCol(0,"asc"); // sort by column 0 in ascending order first
ac.addSortCol(1,"desc"); // then by column 1 in descending order
ac.addSortCol(2,"asc"); // then by column 2 in ascending order
ac.sort(array); // note ac can be used to sort as many arrays as needed after it has been created.
// if you only need to sort by 1 column there is a convenience static method
ArrayComparator.sort(array, 2, "asc");
</code>
</pre>
http://www.fdsapi.com/javadocs/com/fdsapi/ArrayComparator.html
steve - http://www.fdsapi.com - the easiest way to generate dynamic text including html and xml