public List<Employee> getAllData() {
    BufferedReader read = null;
    List<Employee> listOfEmployees = new ArrayList<Employee>();
    String[] listOfFiles;
    listOfFiles = pathToFolderWithEmployees.list();

    for (int i = 0; i < listOfFiles.length; i++) {
      try {
        Employee tempEmployee = new Employee();
        read = new BufferedReader(new FileReader(pathToFolderWithEmployees + "/" + listOfFiles[i]));

        tempEmployee.setID(Integer.parseInt(read.readLine()));
        tempEmployee.setName(read.readLine());
        tempEmployee.setLastName(read.readLine());
        tempEmployee.setAddress(read.readLine());
        tempEmployee.setAge(Integer.parseInt(read.readLine()));
        tempEmployee.setCurrentPaymentBalance(Integer.parseInt(read.readLine()));
        listOfEmployees.add(tempEmployee);

        read.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
      System.out.println();
    }

    return listOfEmployees;
  }
  private void serializeEmployeeToFile(Employee employee, int id) {
    try {
      BufferedWriter write =
          new BufferedWriter(
              new FileWriter(pathToFolderWithEmployees.getAbsolutePath() + "/" + id + ".txt"));
      write.write(Integer.toString(id));
      write.newLine();
      write.write(employee.getName());
      write.newLine();
      write.write(employee.getLastName());
      write.newLine();
      write.write(employee.getAddress());
      write.newLine();
      write.write(Integer.toString(employee.getAge()));
      write.newLine();
      write.write(Integer.toString(employee.getCurrentPaymentBalance()));

      write.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public Employee getSpecificEmployeeData(int id) {
    BufferedReader read = null;
    Employee tempEmployee = new Employee();
    try {
      read = new BufferedReader(new FileReader(pathToFolderWithEmployees + "/" + id + ".txt"));

      tempEmployee.setID(Integer.parseInt(read.readLine()));
      tempEmployee.setName(read.readLine());
      tempEmployee.setLastName(read.readLine());
      tempEmployee.setAddress(read.readLine());
      tempEmployee.setAge(Integer.parseInt(read.readLine()));
      tempEmployee.setCurrentPaymentBalance(Integer.parseInt(read.readLine()));

      read.close();
    } catch (IOException e) {
      e.printStackTrace();
    }
    return tempEmployee;
  }
 public void updateEmployee(Employee employee) {
   serializeEmployeeToFile(employee, employee.getID());
 }