src/main/java/zoot/tube/schedule/TaskIO.java
/**
     * Loads all Tasks that have been saved.
     *
     * @return all Tasks that have been saved.
     */
Loads all Tasks that have been saved.
@return all Tasks that have been saved.
Loads all Tasks that have been saved . @return all Tasks that have been saved .
public static List<Task> loadSavedTasks() {
        Gson gson = new GsonBuilder().create();
        File taskFolder = new File(RESOURCES_TASKS);
        File[] taskFiles = taskFolder.listFiles();
        List<Task> tasks = new ArrayList<>();
        if (taskFiles != null) {
            for (File taskFile : taskFiles) {
                if (!taskFile.getName().equals("empty.txt")) {
                    String taskAsJson = FileIO.readFileToString(taskFile.getPath());
                    tasks.add(gson.fromJson(taskAsJson, Task.class));
                }
            }
        }
        return tasks;
    }
public static List < Task > loadSavedTasks ( ) { Gson gson = new GsonBuilder ( ) . create ( ) ; File taskFolder = new File ( RESOURCES_TASKS ) ; File [ ] taskFiles = taskFolder . listFiles ( ) ; List < Task > tasks = new ArrayList < > ( ) ; if ( taskFiles != null ) { for ( File taskFile : taskFiles ) { if ( ! taskFile . getName ( ) . equals ( "empty.txt" ) ) { String taskAsJson = FileIO . readFileToString ( taskFile . getPath ( ) ) ; tasks . add ( gson . fromJson ( taskAsJson , Task . class ) ) ; } } } return tasks ; }
Loads all Tasks that have been saved.
Loads all Tasks that have been saved .