Package org.jmxtrans.agent.util.collect
Class Iterables2
java.lang.Object
org.jmxtrans.agent.util.collect.Iterables2
public class Iterables2
extends java.lang.Object
Inspired by
com.google.common.collect.Iterables.- Author:
- Cyrille Le Clerc
-
Method Summary
Modifier and Type Method Description static <T> Tget(java.lang.Iterable<T> iterable, int position)Returns the element at the specified position in an iterable.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
get
@Nullable public static <T> T get(@Nonnull java.lang.Iterable<T> iterable, @Nonnegative int position) throws java.lang.NullPointerException, java.lang.IndexOutOfBoundsExceptionReturns the element at the specified position in an iterable.- Parameters:
iterable- the iterable to search intoposition- the position of the entry to return- Returns:
- the entry at the given
locationin the giveniterablethrows - Throws:
java.lang.IndexOutOfBoundsException- if givenpositionis negative or greater than or equal to the size of giveniterablejava.lang.NullPointerException
-