From cd0769abe2fc7e0a91942e618dd00809fd058a70 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 24 Jul 2018 13:39:48 -0700 Subject: small CdxBackfillJob refactor (code quality) --- scalding/src/main/scala/sandcrawler/CdxBackfillJob.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'scalding') 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 = { -- cgit v1.2.3