You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2018/01/10 16:58:00 UTC

[jira] [Closed] (COLLECTIONS-671) Add org.apache.commons.collections4.IterableUtils.first(Iterable)

     [ https://issues.apache.org/jira/browse/COLLECTIONS-671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Gregory closed COLLECTIONS-671.
------------------------------------
    Resolution: Fixed

In git master.

> Add org.apache.commons.collections4.IterableUtils.first(Iterable<E>)
> --------------------------------------------------------------------
>
>                 Key: COLLECTIONS-671
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-671
>             Project: Commons Collections
>          Issue Type: New Feature
>          Components: Iterator
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>             Fix For: 4.2
>
>
> Add org.apache.commons.collections4.IterableUtils.first(Iterable<E>):
> {code:java}
>     /**
>      * Returns the <code>first</code> value in the <code>iterable</code>'s {@link Iterator}, throwing
>      * <code>IndexOutOfBoundsException</code> if there is no such element.
>      * <p>
>      * If the {@link Iterable} is a {@link List}, then it will use {@link List#get(int)}.
>      *
>      * @param <T> the type of object in the {@link Iterable}.
>      * @param iterable  the {@link Iterable} to get a value from, may be null
>      * @return the first object
>      * @throws IndexOutOfBoundsException if the request  is invalid
>      * @since 4.2
>      */
>     public static <T> T first(final Iterable<T> iterable)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)