Scala Iterator hasNext() method with example
The hasNext() method belongs to the Abstract Value Members of the Class AbstractIterator. It is defined in the class Iterator. It checks whether there is a next element available or not.
Method Definition : abstract def hasNext: Boolean
Return Type :It returns true if there is a next element, else it returns false.
Therefore, true is returned as there is a next element.
Therefore, false is returned as there is no next element.