package org.zwobble.couscous.util; import java.util.Iterator; public class ExtraIterables { private ExtraIterables() {} public static void forEach(Iterable first, Iterable second, Action2 action) { Iterator firstIterator = first.iterator(); Iterator secondIterator = second.iterator(); while (firstIterator.hasNext()) { action.run(firstIterator.next(), secondIterator.next()); } if (secondIterator.hasNext()) { throw new RuntimeException("Iterables not of same length"); } } }