All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.edurt.gcm.common.jdk.Iterables Maven / Gradle / Ivy

package io.edurt.gcm.common.jdk;

import java.util.function.BiConsumer;

public class Iterables
{
    private Iterables()
    {}

    /**
     * foreach Enhanced Edition, supporting index setting
     *
     * @param elements elements
     * @param action anonymous function
     * @param  iterable
     */
    public static  void forEach(Iterable elements, BiConsumer action)
    {
        int index = 0;
        for (E element : elements) {
            action.accept(index++, element);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy