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 extends E> elements, BiConsumer action)
{
int index = 0;
for (E element : elements) {
action.accept(index++, element);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy