Java Iterator Size size(Iterator iterator)

Here you can find the source of size(Iterator iterator)

Description

size

License

Open Source License

Declaration

public static <T> long size(Iterator<T> iterator) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Iterator;

public class Main {
    public static <T> long size(Iterator<T> iterator) {
        long size = 0;
        while (iterator.hasNext()) {
            iterator.next();/* ww  w.  j  ava 2 s . co  m*/
            size += 1;
        }
        return size;
    }
}

Related

  1. count(Iterator it)
  2. counter(final Iterator iterator)
  3. size(final Iterator iter)
  4. size(Iterator source)
  5. size(Iterator iterator)