Skip to content

Instantly share code, notes, and snippets.

@lu911
Last active December 20, 2015 21:09
Show Gist options
  • Save lu911/6195789 to your computer and use it in GitHub Desktop.
Save lu911/6195789 to your computer and use it in GitHub Desktop.
Iterable method test
object Main {
def main(args: Array[String]): Unit = {
new IteratorMethods()
}
}
class IteratorMethods(){
private val iterable = Iterable(1,2,3,4,5)
val methods = List(method)
def method()
{
println("head : " + iterable.head)
println("head_option : " + iterable.headOption)
println("last : " + iterable.last)
println("last_option : " + iterable.lastOption)
println("init : " + iterable.init)
println("inits : " + iterable.inits)
println("tail : " + iterable.tail)
println("tails : " + iterable.tails)
println("size : " + iterable.size)
println("isEmpty : " + iterable.isEmpty)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment