Skip to content

Commit

Permalink
use require
Browse files Browse the repository at this point in the history
  • Loading branch information
hhbyyh committed Jun 2, 2015
1 parent 6e4f8ca commit 20a2811
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,12 @@ object MLUtils {
(index, value)
}.unzip

// check if indices is one-based and in ascending order
// check if indices are one-based and in ascending order
var previous = -1
var i = 0
val indicesLength = indices.size
while (i < indicesLength) {
if (indices(i) <= previous) {
throw new IllegalArgumentException("indices should be one-based and in ascending order")
}
require(indices(i) > previous, "indices should be one-based and in ascending order" )
previous = indices(i)
i += 1
}
Expand Down

0 comments on commit 20a2811

Please sign in to comment.