aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/encora/ToDosRepository.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/encora/ToDosRepository.java')
-rw-r--r--src/main/java/com/encora/ToDosRepository.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/com/encora/ToDosRepository.java b/src/main/java/com/encora/ToDosRepository.java
index 65c1b39..e7e939e 100644
--- a/src/main/java/com/encora/ToDosRepository.java
+++ b/src/main/java/com/encora/ToDosRepository.java
@@ -93,6 +93,20 @@ public class ToDosRepository implements JpaRepository<ToDos, Integer> {
return null;
}
+ // Delete a to do.
+ @Override
+ public void deleteById(Integer integer) {
+ ToDos selectedToDo;
+
+ for (int index = 0; index < this.todos.size(); index++) {
+ selectedToDo = this.todos.get(index);
+ if (Objects.equals(selectedToDo.getId(), integer)) {
+ this.todos.remove(index);
+ break;
+ }
+ }
+ }
+
private Comparator<ToDos> getToDoComparator(Sort sort) throws Exception {
// Personal function. Creates a `Comparator` based on the `sort`
// parameter. This is for us to successfully sort our List without the
@@ -231,11 +245,6 @@ public class ToDosRepository implements JpaRepository<ToDos, Integer> {
}
@Override
- public void deleteById(Integer integer) {
-
- }
-
- @Override
public void delete(ToDos entity) {
}