Scala Iterator size() method with example
The size() method belongs to the concrete value members of the class Abstract Iterator. It is defined in the classes IterableOnceOps. It is utilized to find the size of the stated collection. It will not terminate for the infinite sized collection.
Method Definition : def size: Int
Return Type :It returns the size of the stated collection..
Here, the length of the iterator is returned as the stated collection is non-empty.
Here, the length of the iterator is zero as the stated collection is empty.
My Personal Notes arrow_drop_up
Please Login to comment...