Skip to content

Commit

Permalink
delete imp
Browse files Browse the repository at this point in the history
  • Loading branch information
Guy Boldon committed Apr 1, 2018
1 parent be86cf1 commit ea48577
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/com/programmingtolife/TodoController.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public TodoController() {
@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Todo> getList(){
return todoSet.stream().collect(Collectors.toList());
return new ArrayList<>(todoSet); // todoSet.stream().collect(Collectors.toList());
}

@Path("{id}")
Expand All @@ -35,4 +35,9 @@ public Todo addItem(Todo todo){
todoSet.add(todo);
return todo;
}

@DELETE
public void deleteTodo(){
todoSet.removeIf(todo -> todo.getId() == todoSet.size());
}
}

0 comments on commit ea48577

Please sign in to comment.