How about `dirPermissions.foreach { perms => fileSystem.setPermission(path, perms }`?