on 09-05-2011 2:42 PM
Hi Gurus
I had urgent requirement please give your inputs
In my webdynpro java i need to sort entire records in table
I now we need One sorter java class please provide that java file
please suggest the all the steps how to do
Thanks
renu.
Solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. Implement class comparator wich will compare records according your sort preferencies,
like this:
public class record_Comparator implements Comparator{
public int compare(Object emp1, Object emp2){
// here is your code for return -1if 'before' or 0 if equal or 1if 'after'
int stepId_1 = ((record)emp1).get_someValue();
int stepId_2 = ((record)emp2).get_someValue();
if(stepId_1 > stepId_2)
return 1;
else if(stepId_1 < stepId_2)
return -1;
else
return 0;
}
}
than call method sort() with your collection of records,
like this:
Collections.sort(record_collection, new record_Comparator());
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.