Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // EFFECTS: returns a list of todo items whose title and/or description
- // contains the search parameter
- // Note: String comparisons are case sensitive
- public List<TodoItem> filterTodoItemsBySearchTerm(String searchString) {
- ArrayList<TodoItem> temp = new ArrayList<TodoItem>();
- for (TodoItem item : todoItems) {
- if (item.getDescription().toLowerCase().contains(searchString.toLowerCase()) || item.getTitle().toLowerCase().contains(searchString.toLowerCase())) {
- temp.add(item);
- }
- }
- return temp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement