I need to move files for one folder to another
To do this in java I would create a method something like :
private boolean moveFile(List<String> names, dir moveTo){
for(String file : names){
//copy the file from one dir to another
}
}
Is there a more ‘functional’ way to do this in scala or a better way? Maybe using scala I do not even need to loop over the files ?
you’re doing nothing but a side effect so it’s not a very functional task per se. Maybe it’s a bit shorter with the foreach function, but there’s not much of a difference.