I'm learning Scala and I want to transform a line of code from Java. I've tried 2 methods in scala, but they didn't work. The class ResultScanner comes from Apache HBase - ResultScanner and the same for the Result class
Java
for(Result r : resultScanner) System.out.println(r)
Scala
while(resultScanner.hasNext) // error[1]
println(resultScanner.next())
//error[1]: value hasNext is not a member of org.apache.hadoop.hbase.client.ResultScanner
I've tried the following as well :
resultScanner.foreach(println(_)) // error[2]
// error[2]: value foreach is not a member of org.apache.hadoop.hbase.client.ResultScanner
while(resultScanner.iterator().hasNext()) println(resultScanner.next())But it was wrong, because it shows only the half of the results expected. The reason is the result had been incremented on while condition when I doiterator(), I think.