Java Iterator from getIndexInIterator(Iterator iterator, int index)

Here you can find the source of getIndexInIterator(Iterator iterator, int index)

Description

get Index In Iterator

License

Open Source License

Declaration

public static <T> T getIndexInIterator(Iterator<T> iterator, int index) 

Method Source Code

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

import java.util.Iterator;

public class Main {
    public static <T> T getIndexInIterator(Iterator<T> iterator, int index) {
        for (int i = 0; iterator.hasNext(); i++) {
            T current = iterator.next();
            if (i == index) {
                return current;
            }/*from   w w w  .j  a v a2 s .  c  om*/
        }
        return null;
    }
}

Related

  1. getCommaSeparatedValue(Iterator it)
  2. getDestinationType(ImageReadParam param, Iterator imageTypes)
  3. getEmptyIterator()
  4. getEnumeratedObjectCount(Iterator objects)
  5. getFirstChildrendIterator(List children)
  6. getIterable(final Iterator i)
  7. getIterator(final int[] p, final Object[] data)
  8. getIterator(final Object o, final Class classElement)
  9. getIterator(List list)