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> T get​(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.IndexOutOfBoundsException
      Returns the element at the specified position in an iterable.
      Parameters:
      iterable - the iterable to search into
      position - the position of the entry to return
      Returns:
      the entry at the given location in the given iterable throws
      Throws:
      java.lang.IndexOutOfBoundsException - if given position is negative or greater than or equal to the size of given iterable
      java.lang.NullPointerException