Android Java remove item from list, filter list -


i have list of locations in android application. trying remove location list, location id equal value.

this location class:

public class location{      private int locationid;      private string locationname; } 

so there way remove location list<location> without using for or while loop. lambda expression in c#:

var filteredlocations = locations.where(x=>x.locationid!=3).tolist(); 

you can add list of array out using loop using below methods in adapter

//you can use additem adding data in array     public void additem(classname item) {             mlist.add(item);             notifyiteminserted(mlist.size() - 1);         }  //delete deleting whole list of data         public void deleteall() {             mlist.clear();             notifydatasetchanged();         }  //for deleting perticular item data         public void deleteitem(int index) {             mlist.remove(index);             notifyitemremoved(index);          }  //for adding whole set of array         public void addallitems(list<classname> items) {             mlist.addall(items);             notifydatasetchanged();         }  //for updating single item           public void updateitem(int index, classname item) {             mlist.set(index, item);             notifyitemchanged(index);         } 

where mlist array list

public list<classname> mlist = new arraylist<>(); 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -