Java Iterable getByIndex(Iterable iterable, int index)

Here you can find the source of getByIndex(Iterable iterable, int index)

Description

get By Index

License

Open Source License

Declaration

public static <T> T getByIndex(Iterable<T> iterable, int index) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by

import java.util.Iterator;

public class Main {
    public static <T> T getByIndex(Iterable<T> iterable, int index) {
        T el = null;/*from  w ww .jav  a2 s. co m*/
        Iterator<T> it = iterable.iterator();
        for (int i = 0; it.hasNext(); i++) {
            T cur = it.next();
            if (i == index) {
                el = cur;
                break;
            }
        }
        return el;
    }
}

Related

  1. createUpdateTemplate(String table, Iterable columns)
  2. equal(Iterable it1, Iterable it2)
  3. equalsIterablesInOrder(Iterable i1, Iterable i2)
  4. fillFromIterable(C c, Iterable i)
  5. getAny(Iterable iterable)
  6. getElement(final Iterable iterable, int index)
  7. getIdenticalElement(Iterable iterable)
  8. getLongestCommonToken(Iterable iterable, char tokenSeparatorChar)
  9. getMessageString(Iterable msgs)