views:

65

answers:

1

I started the scala REPL an write the following code:

scala> val a = Array(1,2,3,4)
a: Array[Int] = Array(1, 2, 3, 4)

scala> a.`<TAB>`

asInstanceOf   getClass       isInstanceOf   toString

scala> a.exists(_ == 1)
res1: Boolean = true

Why I don't have "exists" listed when I press <TAB>?

+1  A: 

I think it because Array do not have 'exists' method. 'exists' method is belong to ArrayOps.

Eastsun
The gap being bridged by an implicit conversion, making the code valid. And I think you mean `ArrayOps`, not `StringOps`.
Randall Schulz
@Randall Schulz: Yes, it is.
Eastsun