aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDAO.java
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDAO.java')
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDAO.java13
1 files changed, 2 insertions, 11 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDAO.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDAO.java
index 4d11554..3115204 100644
--- a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDAO.java
+++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/CupboardFileDAO.java
@@ -53,22 +53,13 @@ public class CupboardFileDAO implements CupboardDAO {
}
/**
- * Return an array of the needs
- *
- * @return An array of all the needs
- */
- private Need[] getNeedsArray() {
- return needs.values().toArray(Need[]::new);
- }
-
- /**
* Saves the needs to json
*
* @return True if the save was successful, false otherwise
* @throws IOException If there was an IO issue saving the file
*/
private boolean save() throws IOException {
- Need[] needArray = getNeedsArray();
+ Need[] needArray = needs.values().toArray(Need[]::new);
objectMapper.writeValue(new File(filename), needArray);
return true;
@@ -77,7 +68,7 @@ public class CupboardFileDAO implements CupboardDAO {
@Override
public Need[] getNeeds() {
synchronized (needs) {
- return getNeedsArray();
+ return needs.values().toArray(Need[]::new);
}
}