Skip to content

Commit e8be08e

Browse files
committed
for-loop to while-loop in WikiArticle
1 parent 540c267 commit e8be08e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

graphx/src/main/scala/org/apache/spark/graphx/WikiArticle.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ object WikiArticle {
4646
val redirectPattern = "#REDIRECT\\s+\\[\\[(.*?)\\]\\]".r
4747
val disambigPattern = "\\{\\{disambig\\}\\}".r
4848
val stubPattern = "\\-stub\\}\\}".r
49-
val linkPattern = Pattern.compile("\\[\\[(.*?)\\]\\]", Pattern.MULTILINE)
49+
val linkPattern = Pattern.compile("\\[\\[(.*?)\\]\\]", Pattern.MULTILINE)
5050

5151
val notFoundString = "NOTFOUND"
5252

@@ -78,8 +78,10 @@ object WikiArticle {
7878
var h: Long = 1125899906842597L // prime
7979
// var h = 29
8080
val len: Int = s.length
81-
for (i <- 0 until len) {
81+
var i = 0
82+
while (i < len) {
8283
h = 31*h + s.charAt(i)
84+
i += 1
8385
}
8486
h
8587
// val md: MessageDigest = MessageDigest.getInstance("MD5")

0 commit comments

Comments
 (0)