Чтение коллекции с клиентами и сохранение в файл с помощью JFilechooser.
private void writeFile(){
JFileChooser fileChooser = new JFileChooser(this.PATH);
int retValue = fileChooser.showDialog(this, "Save File");
if (retValue == JFileChooser.APPROVE_OPTION){
try (Writer fileWrite = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileChooser.getSelectedFile())))){
this.customers.forEach((c) ->{
try{
fileWrite.append(c.toString()).append("\n");
}
catch (IOException ex){
ex.printStackTrace();
}
});
}
catch (IOException e){
e.printStackTrace();
}
}
}