Reputation: 1943
I have a list of my own class object in android class.
I want to do two things with that list.
First I want to Apply order by like this I used to do with C# code.
myList.orderby(x => x.energyLevel);
Secondly I want to fetch some data from that list. Like this
myList.where(x=>x.gender=="male");
How to do this in android?
Upvotes: 0
Views: 122
Reputation: 9035
orderby
usingArrayList
in android
Collections.sort(myList, new Comparator<MyListObj>(){
public int compare(MyListObj obj1, MyListObj obj2) {
return obj1.x.compareToIgnoreCase(obj2.x);
}
});
Upvotes: 1