Java Iterator getEnumeratedObjectCount(Iterator objects)

Here you can find the source of getEnumeratedObjectCount(Iterator objects)

Description

* Gets the enumerated object count.

License

Open Source License

Parameter

Parameter Description
T the generic type
objects The objects.

Return

Count of objects in iterator.

Declaration

protected static <T> int getEnumeratedObjectCount(Iterator<T> objects) 

Method Source Code

//package com.java2s;

import java.util.*;

public class Main {
    /**// ww w. j  a  v  a  2 s .  c o  m
     * * Gets the enumerated object count.
     *
     * @param <T>     the generic type
     * @param objects The objects.
     * @return Count of objects in iterator.
     */
    protected static <T> int getEnumeratedObjectCount(Iterator<T> objects) {
        int count = 0;
        while (objects != null && objects.hasNext()) {
            @SuppressWarnings("unused")
            Object obj = objects.next();
            count++;
        }
        return count;
    }
}

Related

  1. fmtSeq(Iterator it, String divider)
  2. fromIterator(Iterator iterator)
  3. fromIterator(Iterator iterator)
  4. fromIterator(Iterator itr)
  5. get(Iterator iterator, int position)
  6. getEnumeration(Iterator i)
  7. getIteratorEnumeration(final Iterator i)
  8. getObjectAtIteratorPos(Iterator i, int pos)
  9. hasNext(final Iterator i)