Advertisement
Guest User

Untitled

a guest
Oct 8th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public List<TodoItem> filterTodoItemsByIncompletion() {
  2.  
  3. for(int i=0;i<todoItems.size();i++) {
  4. if(!todoItems.get(i).isCompleted()) {
  5. tmp.add(todoItems.get(i));
  6. }
  7. }
  8. return tmp;
  9. }
  10.  
  11. // EFFECTS: returns a list of to-do items whose title and/or description
  12. // contains the search parameter
  13. // Note: String comparisons are case sensitive
  14. public List<TodoItem> filterTodoItemsBySearchTerm(String searchString) {
  15.  
  16.  
  17. ArrayList<TodoItem> tmp=new ArrayList<TodoItem>();
  18. for(int i=0;i<todoItems.size();i++) {
  19. if(todoItems.get(i).title.contains(searchString)
  20. || todoItems.get(i).description.contains(searchString)) {
  21. tmp.add(todoItems.get(i));
  22. }
  23. }
  24. return tmp;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement