[jvm-packages] avoid use of Seq.apply in buildGroups (#3413)
This commit is contained in:
parent
5cd851ccef
commit
0988fb191f
@ -311,15 +311,15 @@ private object Watches {
|
|||||||
def buildGroups(groups: Seq[Int]): Seq[Int] = {
|
def buildGroups(groups: Seq[Int]): Seq[Int] = {
|
||||||
val output = mutable.ArrayBuffer.empty[Int]
|
val output = mutable.ArrayBuffer.empty[Int]
|
||||||
var count = 1
|
var count = 1
|
||||||
var i = 1
|
var lastGroup = groups.head
|
||||||
while (i < groups.length) {
|
for (group <- groups.tail) {
|
||||||
if (groups(i) != groups(i - 1)) {
|
if (group != lastGroup) {
|
||||||
|
lastGroup = group
|
||||||
output += count
|
output += count
|
||||||
count = 1
|
count = 1
|
||||||
} else {
|
} else {
|
||||||
count += 1
|
count += 1
|
||||||
}
|
}
|
||||||
i += 1
|
|
||||||
}
|
}
|
||||||
output += count
|
output += count
|
||||||
output
|
output
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user