A:
I think the problem is that you have
val x = if (file.isDirectory) None else Some(file.listFiles.filter(_.isDirectory).mkString("/") + "/")
which, for some of your files, will fail to return a Some value, resulting in None for the later joins in your list comprehension
(result. map {
case Some(file) => Some(file.name)
case Some(file) => Some(file.listFiles.filter(_.isDirectory).mkString("/") + "/")
case _ => None
}).map(_.flatten)
You can fix this by filtering out the None cases:
val x = if (file.isDirectory) Some(file.listFiles.filter(_.isDirectory).mkString("/") + "/") else None
There's a bit more can be done, but I'm not sure what you're trying to do with that last line.
This is a fairly common problem with Option. The case is probably covered here, but it's not a great idea to apply None as a String:
val x: String = if (file.isDirectory) Some(file.listFiles.filter(_.isDirectory).mkString("/") + "/") else None
It's just better to construct the right value in the first place:
val x: String = if (file.isDirectory) Some(file.listFiles.filter(_.isDirectory).mkString("/") + "/") else "None"
The number of registered Republicans to vote in Texas’s Republican primary increased in early voting when compared to 2012. Republican turnout is also increasing. The Democratic primary turnout for 2012 also increased from 2012.
Because of the increase in early voting from 2012, the number of Republicans to vote in the 2016 primary is now higher than the 2012 number.
Early voting
According to the Texas Secretary of State’s Office, the number of early voters on March 5 compared to 2012 was 1,287,918, which is a 24.4 percent increase from 2012. That number has decreased from 1,352,562.
The 2012 numbers of early voters were 1,412,431 and 2014 was 1,451,648.
The number of Republicans to vote in 2016 compared to 2012 was 115,054 (3.8 percent be359ba680
Related links:
Comments