Advertisement
yeah568

Untitled

Jul 11th, 2014
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1.     // EFFECTS: returns a list of todo items whose title and/or description
  2.     // contains the search parameter
  3.     // Note: String comparisons are case sensitive
  4.     public List<TodoItem> filterTodoItemsBySearchTerm(String searchString) {
  5.         ArrayList<TodoItem> temp = new ArrayList<TodoItem>();
  6.         for (TodoItem item : todoItems) {
  7.             if (item.getDescription().toLowerCase().contains(searchString.toLowerCase()) || item.getTitle().toLowerCase().contains(searchString.toLowerCase())) {
  8.                 temp.add(item);
  9.             }
  10.         }
  11.         return temp;
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement