Kotlin 带索引的流上ForEach

Kotlin 带索引的流上ForEach,kotlin,Kotlin,是否可以在流上使用某种形式的foreach方法并使用索引 如列表上的forachined{index,value->}?除非您想继续使用Java的流,否则您可以使用: 您的代码变成: stream.asSequence().forachined{…}除非您想继续使用Java的流,否则您可以使用: 您的代码变成: stream.asSequence().forachined{…}

是否可以在
上使用某种形式的foreach方法并使用索引


列表上的
forachined{index,value->}

除非您想继续使用Java的
流,否则您可以使用:

您的代码变成:


stream.asSequence().forachined{…}

除非您想继续使用Java的
流,否则您可以使用:

您的代码变成:

stream.asSequence().forachined{…}