kotlin – Is there a more idiomatic way to iterate ArchiveInputStream or other list type structures

fun ArchiveInputStream.forEachEntry(doThis: (ArchiveEntry) -> Unit) {
    var e: ArchiveEntry?
    while (this.nextEntry.also { e = it } != null) {
        e?.let { doThis(it) }

I’m wondering if there is a better way to call next on an item until it is null and then use that in supplied function. It feels a bit weird to check if it’s null and then to still have to use e?.let instead of just doThis(e)