aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2018-07-24 13:39:48 -0700
committerBryan Newbold <bnewbold@archive.org>2018-07-24 13:39:48 -0700
commitcd0769abe2fc7e0a91942e618dd00809fd058a70 (patch)
tree37319fc49a389c5511d1797bd849d5e8921302f8
parent18bdcfd362a190dd36d3b86996808366b83bbbda (diff)
downloadsandcrawler-cd0769abe2fc7e0a91942e618dd00809fd058a70.tar.gz
sandcrawler-cd0769abe2fc7e0a91942e618dd00809fd058a70.zip
small CdxBackfillJob refactor (code quality)
-rw-r--r--scalding/src/main/scala/sandcrawler/CdxBackfillJob.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/scalding/src/main/scala/sandcrawler/CdxBackfillJob.scala b/scalding/src/main/scala/sandcrawler/CdxBackfillJob.scala
index 389a96a..963fb10 100644
--- a/scalding/src/main/scala/sandcrawler/CdxBackfillJob.scala
+++ b/scalding/src/main/scala/sandcrawler/CdxBackfillJob.scala
@@ -108,12 +108,12 @@ object CdxBackfillJob {
)
val lower = raw.toLowerCase()
- normalMime.foreach { case (key, value) =>
- if (lower.startsWith(key)) {
- return value
- }
+ normalMime.find { case (key, _) =>
+ lower.startsWith(key)
+ } match {
+ case Some((_, value)) => value
+ case None => lower
}
- lower
}
def isCdxLine(line: String) : Boolean = {