The isTraversableAgain() method belongs to the concrete value member of the class iterator in Scala. It checks whether the iterator can be repeatedly traversed or not.
- Method Definition:
def isTraversableAgain: Boolean
- Return Type:
It returns true if the stated iterator can be traversed repeatedly and if it cannot be traversed repeatedly then it returns false.
Here, the iterator cannot be traversed repeatedly so, it returns false.
Here, we have declared an empty iterator and even that cannot be traversed repeatedly so, the method returns false.