forEachWithLookahead

inline fun <T> Iterator<T>.forEachWithLookahead(action: (T, Boolean) -> Unit)
inline fun <T> Iterable<T>.forEachWithLookahead(action: (T, Boolean) -> Unit)
inline fun <T> Sequence<T>.forEachWithLookahead(action: (T, Boolean) -> Unit)

Performs the given action on each element, giving a lookahead hint (i.e. if there's another element to process after).