This is only used in tests and marked `private[mllib]`. For SparseVector, binary search is used to get the value, which is actually fine if the operation does not apply to every index.