Unify withIndex docs wording

This commit is contained in:
Ilya Gorbunov
2019-07-30 22:58:08 +03:00
parent 2e445ebad6
commit 65b0a5f903
7 changed files with 39 additions and 19 deletions
@@ -9304,63 +9304,72 @@ public inline fun <R, C : MutableCollection<in R>> CharArray.mapTo(destination:
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun <T> Array<out T>.withIndex(): Iterable<IndexedValue<T>> {
return IndexingIterable { iterator() }
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun ByteArray.withIndex(): Iterable<IndexedValue<Byte>> {
return IndexingIterable { iterator() }
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun ShortArray.withIndex(): Iterable<IndexedValue<Short>> {
return IndexingIterable { iterator() }
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun IntArray.withIndex(): Iterable<IndexedValue<Int>> {
return IndexingIterable { iterator() }
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun LongArray.withIndex(): Iterable<IndexedValue<Long>> {
return IndexingIterable { iterator() }
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun FloatArray.withIndex(): Iterable<IndexedValue<Float>> {
return IndexingIterable { iterator() }
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun DoubleArray.withIndex(): Iterable<IndexedValue<Double>> {
return IndexingIterable { iterator() }
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun BooleanArray.withIndex(): Iterable<IndexedValue<Boolean>> {
return IndexingIterable { iterator() }
}
/**
* Returns a lazy [Iterable] of [IndexedValue] for each element of the original array.
* Returns a lazy [Iterable] that wraps each element of the original array
* into an [IndexedValue] containing the index of that element and the element itself.
*/
public fun CharArray.withIndex(): Iterable<IndexedValue<Char>> {
return IndexingIterable { iterator() }