Prettify kdocs and exception messages in the generated code.

This commit is contained in:
Ilya Gorbunov
2015-05-27 18:21:17 +03:00
parent fe49a2ee51
commit ae60f7a32f
28 changed files with 1523 additions and 1522 deletions
+9 -9
View File
@@ -11,7 +11,7 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun <T> Array<out T>.asList(): List<T> { public fun <T> Array<out T>.asList(): List<T> {
val al = ArrayList<T>() val al = ArrayList<T>()
@@ -20,56 +20,56 @@ public fun <T> Array<out T>.asList(): List<T> {
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public inline fun BooleanArray.asList(): List<Boolean> { public inline fun BooleanArray.asList(): List<Boolean> {
return (this as Array<Boolean>).asList() return (this as Array<Boolean>).asList()
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public inline fun ByteArray.asList(): List<Byte> { public inline fun ByteArray.asList(): List<Byte> {
return (this as Array<Byte>).asList() return (this as Array<Byte>).asList()
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public inline fun CharArray.asList(): List<Char> { public inline fun CharArray.asList(): List<Char> {
return (this as Array<Char>).asList() return (this as Array<Char>).asList()
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public inline fun DoubleArray.asList(): List<Double> { public inline fun DoubleArray.asList(): List<Double> {
return (this as Array<Double>).asList() return (this as Array<Double>).asList()
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public inline fun FloatArray.asList(): List<Float> { public inline fun FloatArray.asList(): List<Float> {
return (this as Array<Float>).asList() return (this as Array<Float>).asList()
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public inline fun IntArray.asList(): List<Int> { public inline fun IntArray.asList(): List<Int> {
return (this as Array<Int>).asList() return (this as Array<Int>).asList()
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public inline fun LongArray.asList(): List<Long> { public inline fun LongArray.asList(): List<Long> {
return (this as Array<Long>).asList() return (this as Array<Long>).asList()
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public inline fun ShortArray.asList(): List<Short> { public inline fun ShortArray.asList(): List<Short> {
return (this as Array<Short>).asList() return (this as Array<Short>).asList()
File diff suppressed because it is too large Load Diff
+45 -45
View File
@@ -11,7 +11,7 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun <T> Array<out T>.asIterable(): Iterable<T> { public fun <T> Array<out T>.asIterable(): Iterable<T> {
return object : Iterable<T> { return object : Iterable<T> {
@@ -20,7 +20,7 @@ public fun <T> Array<out T>.asIterable(): Iterable<T> {
} }
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun BooleanArray.asIterable(): Iterable<Boolean> { public fun BooleanArray.asIterable(): Iterable<Boolean> {
return object : Iterable<Boolean> { return object : Iterable<Boolean> {
@@ -29,7 +29,7 @@ public fun BooleanArray.asIterable(): Iterable<Boolean> {
} }
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun ByteArray.asIterable(): Iterable<Byte> { public fun ByteArray.asIterable(): Iterable<Byte> {
return object : Iterable<Byte> { return object : Iterable<Byte> {
@@ -38,7 +38,7 @@ public fun ByteArray.asIterable(): Iterable<Byte> {
} }
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun CharArray.asIterable(): Iterable<Char> { public fun CharArray.asIterable(): Iterable<Char> {
return object : Iterable<Char> { return object : Iterable<Char> {
@@ -47,7 +47,7 @@ public fun CharArray.asIterable(): Iterable<Char> {
} }
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun DoubleArray.asIterable(): Iterable<Double> { public fun DoubleArray.asIterable(): Iterable<Double> {
return object : Iterable<Double> { return object : Iterable<Double> {
@@ -56,7 +56,7 @@ public fun DoubleArray.asIterable(): Iterable<Double> {
} }
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun FloatArray.asIterable(): Iterable<Float> { public fun FloatArray.asIterable(): Iterable<Float> {
return object : Iterable<Float> { return object : Iterable<Float> {
@@ -65,7 +65,7 @@ public fun FloatArray.asIterable(): Iterable<Float> {
} }
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun IntArray.asIterable(): Iterable<Int> { public fun IntArray.asIterable(): Iterable<Int> {
return object : Iterable<Int> { return object : Iterable<Int> {
@@ -74,7 +74,7 @@ public fun IntArray.asIterable(): Iterable<Int> {
} }
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun LongArray.asIterable(): Iterable<Long> { public fun LongArray.asIterable(): Iterable<Long> {
return object : Iterable<Long> { return object : Iterable<Long> {
@@ -83,7 +83,7 @@ public fun LongArray.asIterable(): Iterable<Long> {
} }
/** /**
* Returns the Iterable that wraps the original array * Returns the Iterable that wraps the original array.
*/ */
public fun ShortArray.asIterable(): Iterable<Short> { public fun ShortArray.asIterable(): Iterable<Short> {
return object : Iterable<Short> { return object : Iterable<Short> {
@@ -92,235 +92,235 @@ public fun ShortArray.asIterable(): Iterable<Short> {
} }
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val <T> Array<out T>.indices: IntRange public val <T> Array<out T>.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val BooleanArray.indices: IntRange public val BooleanArray.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val ByteArray.indices: IntRange public val ByteArray.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val CharArray.indices: IntRange public val CharArray.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val DoubleArray.indices: IntRange public val DoubleArray.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val FloatArray.indices: IntRange public val FloatArray.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val IntArray.indices: IntRange public val IntArray.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val LongArray.indices: IntRange public val LongArray.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns the range of valid indices for the array * Returns the range of valid indices for the array.
*/ */
public val ShortArray.indices: IntRange public val ShortArray.indices: IntRange
get() = IntRange(0, lastIndex) get() = IntRange(0, lastIndex)
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun <T> Array<out T>.isEmpty(): Boolean { public fun <T> Array<out T>.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun BooleanArray.isEmpty(): Boolean { public fun BooleanArray.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun ByteArray.isEmpty(): Boolean { public fun ByteArray.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun CharArray.isEmpty(): Boolean { public fun CharArray.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun DoubleArray.isEmpty(): Boolean { public fun DoubleArray.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun FloatArray.isEmpty(): Boolean { public fun FloatArray.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun IntArray.isEmpty(): Boolean { public fun IntArray.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun LongArray.isEmpty(): Boolean { public fun LongArray.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is empty * Returns `true` if the array is empty.
*/ */
public fun ShortArray.isEmpty(): Boolean { public fun ShortArray.isEmpty(): Boolean {
return size() == 0 return size() == 0
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun <T> Array<out T>.isNotEmpty(): Boolean { public fun <T> Array<out T>.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun BooleanArray.isNotEmpty(): Boolean { public fun BooleanArray.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun ByteArray.isNotEmpty(): Boolean { public fun ByteArray.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun CharArray.isNotEmpty(): Boolean { public fun CharArray.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun DoubleArray.isNotEmpty(): Boolean { public fun DoubleArray.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun FloatArray.isNotEmpty(): Boolean { public fun FloatArray.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun IntArray.isNotEmpty(): Boolean { public fun IntArray.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun LongArray.isNotEmpty(): Boolean { public fun LongArray.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns true if the array is not empty * Returns `true` if the array is not empty.
*/ */
public fun ShortArray.isNotEmpty(): Boolean { public fun ShortArray.isNotEmpty(): Boolean {
return !isEmpty() return !isEmpty()
} }
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val <T> Array<out T>.lastIndex: Int public val <T> Array<out T>.lastIndex: Int
get() = size() - 1 get() = size() - 1
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val BooleanArray.lastIndex: Int public val BooleanArray.lastIndex: Int
get() = size() - 1 get() = size() - 1
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val ByteArray.lastIndex: Int public val ByteArray.lastIndex: Int
get() = size() - 1 get() = size() - 1
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val CharArray.lastIndex: Int public val CharArray.lastIndex: Int
get() = size() - 1 get() = size() - 1
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val DoubleArray.lastIndex: Int public val DoubleArray.lastIndex: Int
get() = size() - 1 get() = size() - 1
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val FloatArray.lastIndex: Int public val FloatArray.lastIndex: Int
get() = size() - 1 get() = size() - 1
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val IntArray.lastIndex: Int public val IntArray.lastIndex: Int
get() = size() - 1 get() = size() - 1
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val LongArray.lastIndex: Int public val LongArray.lastIndex: Int
get() = size() - 1 get() = size() - 1
/** /**
* Returns the last valid index for the array * Returns the last valid index for the array.
*/ */
public val ShortArray.lastIndex: Int public val ShortArray.lastIndex: Int
get() = size() - 1 get() = size() - 1
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+92 -92
View File
@@ -11,7 +11,7 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <T, R, V> Array<out T>.merge(array: Array<out R>, transform: (T, R) -> V): List<V> { public inline fun <T, R, V> Array<out T>.merge(array: Array<out R>, transform: (T, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -24,7 +24,7 @@ public inline fun <T, R, V> Array<out T>.merge(array: Array<out R>, transform: (
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> BooleanArray.merge(array: Array<out R>, transform: (Boolean, R) -> V): List<V> { public inline fun <R, V> BooleanArray.merge(array: Array<out R>, transform: (Boolean, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -37,7 +37,7 @@ public inline fun <R, V> BooleanArray.merge(array: Array<out R>, transform: (Boo
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> ByteArray.merge(array: Array<out R>, transform: (Byte, R) -> V): List<V> { public inline fun <R, V> ByteArray.merge(array: Array<out R>, transform: (Byte, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -50,7 +50,7 @@ public inline fun <R, V> ByteArray.merge(array: Array<out R>, transform: (Byte,
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> CharArray.merge(array: Array<out R>, transform: (Char, R) -> V): List<V> { public inline fun <R, V> CharArray.merge(array: Array<out R>, transform: (Char, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -63,7 +63,7 @@ public inline fun <R, V> CharArray.merge(array: Array<out R>, transform: (Char,
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> DoubleArray.merge(array: Array<out R>, transform: (Double, R) -> V): List<V> { public inline fun <R, V> DoubleArray.merge(array: Array<out R>, transform: (Double, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -76,7 +76,7 @@ public inline fun <R, V> DoubleArray.merge(array: Array<out R>, transform: (Doub
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> FloatArray.merge(array: Array<out R>, transform: (Float, R) -> V): List<V> { public inline fun <R, V> FloatArray.merge(array: Array<out R>, transform: (Float, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -89,7 +89,7 @@ public inline fun <R, V> FloatArray.merge(array: Array<out R>, transform: (Float
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> IntArray.merge(array: Array<out R>, transform: (Int, R) -> V): List<V> { public inline fun <R, V> IntArray.merge(array: Array<out R>, transform: (Int, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -102,7 +102,7 @@ public inline fun <R, V> IntArray.merge(array: Array<out R>, transform: (Int, R)
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> LongArray.merge(array: Array<out R>, transform: (Long, R) -> V): List<V> { public inline fun <R, V> LongArray.merge(array: Array<out R>, transform: (Long, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -115,7 +115,7 @@ public inline fun <R, V> LongArray.merge(array: Array<out R>, transform: (Long,
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> ShortArray.merge(array: Array<out R>, transform: (Short, R) -> V): List<V> { public inline fun <R, V> ShortArray.merge(array: Array<out R>, transform: (Short, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -128,7 +128,7 @@ public inline fun <R, V> ShortArray.merge(array: Array<out R>, transform: (Short
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <T, R, V> Iterable<T>.merge(array: Array<out R>, transform: (T, R) -> V): List<V> { public inline fun <T, R, V> Iterable<T>.merge(array: Array<out R>, transform: (T, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -141,7 +141,7 @@ public inline fun <T, R, V> Iterable<T>.merge(array: Array<out R>, transform: (T
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <V> BooleanArray.merge(array: BooleanArray, transform: (Boolean, Boolean) -> V): List<V> { public inline fun <V> BooleanArray.merge(array: BooleanArray, transform: (Boolean, Boolean) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -154,7 +154,7 @@ public inline fun <V> BooleanArray.merge(array: BooleanArray, transform: (Boolea
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <V> ByteArray.merge(array: ByteArray, transform: (Byte, Byte) -> V): List<V> { public inline fun <V> ByteArray.merge(array: ByteArray, transform: (Byte, Byte) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -167,7 +167,7 @@ public inline fun <V> ByteArray.merge(array: ByteArray, transform: (Byte, Byte)
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <V> CharArray.merge(array: CharArray, transform: (Char, Char) -> V): List<V> { public inline fun <V> CharArray.merge(array: CharArray, transform: (Char, Char) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -180,7 +180,7 @@ public inline fun <V> CharArray.merge(array: CharArray, transform: (Char, Char)
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <V> DoubleArray.merge(array: DoubleArray, transform: (Double, Double) -> V): List<V> { public inline fun <V> DoubleArray.merge(array: DoubleArray, transform: (Double, Double) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -193,7 +193,7 @@ public inline fun <V> DoubleArray.merge(array: DoubleArray, transform: (Double,
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <V> FloatArray.merge(array: FloatArray, transform: (Float, Float) -> V): List<V> { public inline fun <V> FloatArray.merge(array: FloatArray, transform: (Float, Float) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -206,7 +206,7 @@ public inline fun <V> FloatArray.merge(array: FloatArray, transform: (Float, Flo
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <V> IntArray.merge(array: IntArray, transform: (Int, Int) -> V): List<V> { public inline fun <V> IntArray.merge(array: IntArray, transform: (Int, Int) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -219,7 +219,7 @@ public inline fun <V> IntArray.merge(array: IntArray, transform: (Int, Int) -> V
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <V> LongArray.merge(array: LongArray, transform: (Long, Long) -> V): List<V> { public inline fun <V> LongArray.merge(array: LongArray, transform: (Long, Long) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -232,7 +232,7 @@ public inline fun <V> LongArray.merge(array: LongArray, transform: (Long, Long)
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <V> ShortArray.merge(array: ShortArray, transform: (Short, Short) -> V): List<V> { public inline fun <V> ShortArray.merge(array: ShortArray, transform: (Short, Short) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -245,7 +245,7 @@ public inline fun <V> ShortArray.merge(array: ShortArray, transform: (Short, Sho
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <T, R, V> Array<out T>.merge(other: Iterable<R>, transform: (T, R) -> V): List<V> { public inline fun <T, R, V> Array<out T>.merge(other: Iterable<R>, transform: (T, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -258,7 +258,7 @@ public inline fun <T, R, V> Array<out T>.merge(other: Iterable<R>, transform: (T
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> BooleanArray.merge(other: Iterable<R>, transform: (Boolean, R) -> V): List<V> { public inline fun <R, V> BooleanArray.merge(other: Iterable<R>, transform: (Boolean, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -271,7 +271,7 @@ public inline fun <R, V> BooleanArray.merge(other: Iterable<R>, transform: (Bool
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> ByteArray.merge(other: Iterable<R>, transform: (Byte, R) -> V): List<V> { public inline fun <R, V> ByteArray.merge(other: Iterable<R>, transform: (Byte, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -284,7 +284,7 @@ public inline fun <R, V> ByteArray.merge(other: Iterable<R>, transform: (Byte, R
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> CharArray.merge(other: Iterable<R>, transform: (Char, R) -> V): List<V> { public inline fun <R, V> CharArray.merge(other: Iterable<R>, transform: (Char, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -297,7 +297,7 @@ public inline fun <R, V> CharArray.merge(other: Iterable<R>, transform: (Char, R
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> DoubleArray.merge(other: Iterable<R>, transform: (Double, R) -> V): List<V> { public inline fun <R, V> DoubleArray.merge(other: Iterable<R>, transform: (Double, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -310,7 +310,7 @@ public inline fun <R, V> DoubleArray.merge(other: Iterable<R>, transform: (Doubl
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> FloatArray.merge(other: Iterable<R>, transform: (Float, R) -> V): List<V> { public inline fun <R, V> FloatArray.merge(other: Iterable<R>, transform: (Float, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -323,7 +323,7 @@ public inline fun <R, V> FloatArray.merge(other: Iterable<R>, transform: (Float,
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> IntArray.merge(other: Iterable<R>, transform: (Int, R) -> V): List<V> { public inline fun <R, V> IntArray.merge(other: Iterable<R>, transform: (Int, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -336,7 +336,7 @@ public inline fun <R, V> IntArray.merge(other: Iterable<R>, transform: (Int, R)
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> LongArray.merge(other: Iterable<R>, transform: (Long, R) -> V): List<V> { public inline fun <R, V> LongArray.merge(other: Iterable<R>, transform: (Long, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -349,7 +349,7 @@ public inline fun <R, V> LongArray.merge(other: Iterable<R>, transform: (Long, R
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <R, V> ShortArray.merge(other: Iterable<R>, transform: (Short, R) -> V): List<V> { public inline fun <R, V> ShortArray.merge(other: Iterable<R>, transform: (Short, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -362,7 +362,7 @@ public inline fun <R, V> ShortArray.merge(other: Iterable<R>, transform: (Short,
} }
/** /**
* Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. * Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
*/ */
public inline fun <T, R, V> Iterable<T>.merge(other: Iterable<R>, transform: (T, R) -> V): List<V> { public inline fun <T, R, V> Iterable<T>.merge(other: Iterable<R>, transform: (T, R) -> V): List<V> {
val first = iterator() val first = iterator()
@@ -375,7 +375,7 @@ public inline fun <T, R, V> Iterable<T>.merge(other: Iterable<R>, transform: (T,
} }
/** /**
* Returns a sequence of values built from elements of both collections with same indexes using provided *transform*. Resulting sequence has length of shortest input sequences. * Returns a sequence of values built from elements of both collections with same indexes using provided [transform]. Resulting sequence has length of shortest input sequences.
*/ */
public fun <T, R, V> Sequence<T>.merge(sequence: Sequence<R>, transform: (T, R) -> V): Sequence<V> { public fun <T, R, V> Sequence<T>.merge(sequence: Sequence<R>, transform: (T, R) -> V): Sequence<V> {
return MergingSequence(this, sequence, transform) return MergingSequence(this, sequence, transform)
@@ -384,7 +384,7 @@ public fun <T, R, V> Sequence<T>.merge(sequence: Sequence<R>, transform: (T, R)
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a stream of values built from elements of both collections with same indexes using provided *transform*. Resulting stream has length of shortest input streams. * Returns a stream of values built from elements of both collections with same indexes using provided [transform]. Resulting stream has length of shortest input streams.
*/ */
public fun <T, R, V> Stream<T>.merge(stream: Stream<R>, transform: (T, R) -> V): Stream<V> { public fun <T, R, V> Stream<T>.merge(stream: Stream<R>, transform: (T, R) -> V): Stream<V> {
return MergingStream(this, stream, transform) return MergingStream(this, stream, transform)
@@ -392,8 +392,8 @@ public fun <T, R, V> Stream<T>.merge(stream: Stream<R>, transform: (T, R) -> V):
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun <T> Array<out T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> { public inline fun <T> Array<out T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> {
val first = ArrayList<T>() val first = ArrayList<T>()
@@ -410,8 +410,8 @@ public inline fun <T> Array<out T>.partition(predicate: (T) -> Boolean): Pair<Li
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun BooleanArray.partition(predicate: (Boolean) -> Boolean): Pair<List<Boolean>, List<Boolean>> { public inline fun BooleanArray.partition(predicate: (Boolean) -> Boolean): Pair<List<Boolean>, List<Boolean>> {
val first = ArrayList<Boolean>() val first = ArrayList<Boolean>()
@@ -428,8 +428,8 @@ public inline fun BooleanArray.partition(predicate: (Boolean) -> Boolean): Pair<
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun ByteArray.partition(predicate: (Byte) -> Boolean): Pair<List<Byte>, List<Byte>> { public inline fun ByteArray.partition(predicate: (Byte) -> Boolean): Pair<List<Byte>, List<Byte>> {
val first = ArrayList<Byte>() val first = ArrayList<Byte>()
@@ -446,8 +446,8 @@ public inline fun ByteArray.partition(predicate: (Byte) -> Boolean): Pair<List<B
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun CharArray.partition(predicate: (Char) -> Boolean): Pair<List<Char>, List<Char>> { public inline fun CharArray.partition(predicate: (Char) -> Boolean): Pair<List<Char>, List<Char>> {
val first = ArrayList<Char>() val first = ArrayList<Char>()
@@ -464,8 +464,8 @@ public inline fun CharArray.partition(predicate: (Char) -> Boolean): Pair<List<C
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun DoubleArray.partition(predicate: (Double) -> Boolean): Pair<List<Double>, List<Double>> { public inline fun DoubleArray.partition(predicate: (Double) -> Boolean): Pair<List<Double>, List<Double>> {
val first = ArrayList<Double>() val first = ArrayList<Double>()
@@ -482,8 +482,8 @@ public inline fun DoubleArray.partition(predicate: (Double) -> Boolean): Pair<Li
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun FloatArray.partition(predicate: (Float) -> Boolean): Pair<List<Float>, List<Float>> { public inline fun FloatArray.partition(predicate: (Float) -> Boolean): Pair<List<Float>, List<Float>> {
val first = ArrayList<Float>() val first = ArrayList<Float>()
@@ -500,8 +500,8 @@ public inline fun FloatArray.partition(predicate: (Float) -> Boolean): Pair<List
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun IntArray.partition(predicate: (Int) -> Boolean): Pair<List<Int>, List<Int>> { public inline fun IntArray.partition(predicate: (Int) -> Boolean): Pair<List<Int>, List<Int>> {
val first = ArrayList<Int>() val first = ArrayList<Int>()
@@ -518,8 +518,8 @@ public inline fun IntArray.partition(predicate: (Int) -> Boolean): Pair<List<Int
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun LongArray.partition(predicate: (Long) -> Boolean): Pair<List<Long>, List<Long>> { public inline fun LongArray.partition(predicate: (Long) -> Boolean): Pair<List<Long>, List<Long>> {
val first = ArrayList<Long>() val first = ArrayList<Long>()
@@ -536,8 +536,8 @@ public inline fun LongArray.partition(predicate: (Long) -> Boolean): Pair<List<L
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun ShortArray.partition(predicate: (Short) -> Boolean): Pair<List<Short>, List<Short>> { public inline fun ShortArray.partition(predicate: (Short) -> Boolean): Pair<List<Short>, List<Short>> {
val first = ArrayList<Short>() val first = ArrayList<Short>()
@@ -554,8 +554,8 @@ public inline fun ShortArray.partition(predicate: (Short) -> Boolean): Pair<List
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun <T> Iterable<T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> { public inline fun <T> Iterable<T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> {
val first = ArrayList<T>() val first = ArrayList<T>()
@@ -572,8 +572,8 @@ public inline fun <T> Iterable<T>.partition(predicate: (T) -> Boolean): Pair<Lis
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun <T> Sequence<T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> { public inline fun <T> Sequence<T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> {
val first = ArrayList<T>() val first = ArrayList<T>()
@@ -592,8 +592,8 @@ public inline fun <T> Sequence<T>.partition(predicate: (T) -> Boolean): Pair<Lis
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun <T> Stream<T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> { public inline fun <T> Stream<T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> {
val first = ArrayList<T>() val first = ArrayList<T>()
@@ -610,8 +610,8 @@ public inline fun <T> Stream<T>.partition(predicate: (T) -> Boolean): Pair<List<
/** /**
* Splits original collection into pair of collections, * Splits original collection into pair of collections,
* where *first* collection contains elements for which predicate yielded *true*, * where *first* collection contains elements for which [predicate] yielded [true],
* while *second* collection contains elements for which predicate yielded *false* * while *second* collection contains elements for which [predicate] yielded [false].
*/ */
public inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, String> { public inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, String> {
val first = StringBuilder() val first = StringBuilder()
@@ -627,7 +627,7 @@ public inline fun String.partition(predicate: (Char) -> Boolean): Pair<String, S
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun <T> Array<out T>.plus(array: Array<out T>): List<T> { public fun <T> Array<out T>.plus(array: Array<out T>): List<T> {
val answer = ArrayList<T>(size() + array.size()) val answer = ArrayList<T>(size() + array.size())
@@ -637,7 +637,7 @@ public fun <T> Array<out T>.plus(array: Array<out T>): List<T> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun BooleanArray.plus(array: Array<out Boolean>): List<Boolean> { public fun BooleanArray.plus(array: Array<out Boolean>): List<Boolean> {
val answer = ArrayList<Boolean>(size() + array.size()) val answer = ArrayList<Boolean>(size() + array.size())
@@ -647,7 +647,7 @@ public fun BooleanArray.plus(array: Array<out Boolean>): List<Boolean> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun ByteArray.plus(array: Array<out Byte>): List<Byte> { public fun ByteArray.plus(array: Array<out Byte>): List<Byte> {
val answer = ArrayList<Byte>(size() + array.size()) val answer = ArrayList<Byte>(size() + array.size())
@@ -657,7 +657,7 @@ public fun ByteArray.plus(array: Array<out Byte>): List<Byte> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun CharArray.plus(array: Array<out Char>): List<Char> { public fun CharArray.plus(array: Array<out Char>): List<Char> {
val answer = ArrayList<Char>(size() + array.size()) val answer = ArrayList<Char>(size() + array.size())
@@ -667,7 +667,7 @@ public fun CharArray.plus(array: Array<out Char>): List<Char> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun DoubleArray.plus(array: Array<out Double>): List<Double> { public fun DoubleArray.plus(array: Array<out Double>): List<Double> {
val answer = ArrayList<Double>(size() + array.size()) val answer = ArrayList<Double>(size() + array.size())
@@ -677,7 +677,7 @@ public fun DoubleArray.plus(array: Array<out Double>): List<Double> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun FloatArray.plus(array: Array<out Float>): List<Float> { public fun FloatArray.plus(array: Array<out Float>): List<Float> {
val answer = ArrayList<Float>(size() + array.size()) val answer = ArrayList<Float>(size() + array.size())
@@ -687,7 +687,7 @@ public fun FloatArray.plus(array: Array<out Float>): List<Float> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun IntArray.plus(array: Array<out Int>): List<Int> { public fun IntArray.plus(array: Array<out Int>): List<Int> {
val answer = ArrayList<Int>(size() + array.size()) val answer = ArrayList<Int>(size() + array.size())
@@ -697,7 +697,7 @@ public fun IntArray.plus(array: Array<out Int>): List<Int> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun LongArray.plus(array: Array<out Long>): List<Long> { public fun LongArray.plus(array: Array<out Long>): List<Long> {
val answer = ArrayList<Long>(size() + array.size()) val answer = ArrayList<Long>(size() + array.size())
@@ -707,7 +707,7 @@ public fun LongArray.plus(array: Array<out Long>): List<Long> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun ShortArray.plus(array: Array<out Short>): List<Short> { public fun ShortArray.plus(array: Array<out Short>): List<Short> {
val answer = ArrayList<Short>(size() + array.size()) val answer = ArrayList<Short>(size() + array.size())
@@ -717,7 +717,7 @@ public fun ShortArray.plus(array: Array<out Short>): List<Short> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun <T> Iterable<T>.plus(array: Array<out T>): List<T> { public fun <T> Iterable<T>.plus(array: Array<out T>): List<T> {
val answer = ArrayList<T>(collectionSizeOrDefault(10) + array.size()) val answer = ArrayList<T>(collectionSizeOrDefault(10) + array.size())
@@ -727,7 +727,7 @@ public fun <T> Iterable<T>.plus(array: Array<out T>): List<T> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun <T> Array<out T>.plus(collection: Iterable<T>): List<T> { public fun <T> Array<out T>.plus(collection: Iterable<T>): List<T> {
val answer = ArrayList<T>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<T>(size() + collection.collectionSizeOrDefault(10))
@@ -737,7 +737,7 @@ public fun <T> Array<out T>.plus(collection: Iterable<T>): List<T> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun BooleanArray.plus(collection: Iterable<Boolean>): List<Boolean> { public fun BooleanArray.plus(collection: Iterable<Boolean>): List<Boolean> {
val answer = ArrayList<Boolean>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<Boolean>(size() + collection.collectionSizeOrDefault(10))
@@ -747,7 +747,7 @@ public fun BooleanArray.plus(collection: Iterable<Boolean>): List<Boolean> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun ByteArray.plus(collection: Iterable<Byte>): List<Byte> { public fun ByteArray.plus(collection: Iterable<Byte>): List<Byte> {
val answer = ArrayList<Byte>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<Byte>(size() + collection.collectionSizeOrDefault(10))
@@ -757,7 +757,7 @@ public fun ByteArray.plus(collection: Iterable<Byte>): List<Byte> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun CharArray.plus(collection: Iterable<Char>): List<Char> { public fun CharArray.plus(collection: Iterable<Char>): List<Char> {
val answer = ArrayList<Char>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<Char>(size() + collection.collectionSizeOrDefault(10))
@@ -767,7 +767,7 @@ public fun CharArray.plus(collection: Iterable<Char>): List<Char> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun DoubleArray.plus(collection: Iterable<Double>): List<Double> { public fun DoubleArray.plus(collection: Iterable<Double>): List<Double> {
val answer = ArrayList<Double>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<Double>(size() + collection.collectionSizeOrDefault(10))
@@ -777,7 +777,7 @@ public fun DoubleArray.plus(collection: Iterable<Double>): List<Double> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun FloatArray.plus(collection: Iterable<Float>): List<Float> { public fun FloatArray.plus(collection: Iterable<Float>): List<Float> {
val answer = ArrayList<Float>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<Float>(size() + collection.collectionSizeOrDefault(10))
@@ -787,7 +787,7 @@ public fun FloatArray.plus(collection: Iterable<Float>): List<Float> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun IntArray.plus(collection: Iterable<Int>): List<Int> { public fun IntArray.plus(collection: Iterable<Int>): List<Int> {
val answer = ArrayList<Int>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<Int>(size() + collection.collectionSizeOrDefault(10))
@@ -797,7 +797,7 @@ public fun IntArray.plus(collection: Iterable<Int>): List<Int> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun LongArray.plus(collection: Iterable<Long>): List<Long> { public fun LongArray.plus(collection: Iterable<Long>): List<Long> {
val answer = ArrayList<Long>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<Long>(size() + collection.collectionSizeOrDefault(10))
@@ -807,7 +807,7 @@ public fun LongArray.plus(collection: Iterable<Long>): List<Long> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun ShortArray.plus(collection: Iterable<Short>): List<Short> { public fun ShortArray.plus(collection: Iterable<Short>): List<Short> {
val answer = ArrayList<Short>(size() + collection.collectionSizeOrDefault(10)) val answer = ArrayList<Short>(size() + collection.collectionSizeOrDefault(10))
@@ -817,7 +817,7 @@ public fun ShortArray.plus(collection: Iterable<Short>): List<Short> {
} }
/** /**
* Returns a list containing all elements of original collection and then all elements of the given *collection* * Returns a list containing all elements of original collection and then all elements of the given [collection].
*/ */
public fun <T> Iterable<T>.plus(collection: Iterable<T>): List<T> { public fun <T> Iterable<T>.plus(collection: Iterable<T>): List<T> {
val answer = ArrayList<T>(collectionSizeOrDefault(10) + collection.collectionSizeOrDefault(10)) val answer = ArrayList<T>(collectionSizeOrDefault(10) + collection.collectionSizeOrDefault(10))
@@ -827,7 +827,7 @@ public fun <T> Iterable<T>.plus(collection: Iterable<T>): List<T> {
} }
/** /**
* Returns a sequence containing all elements of original sequence and then all elements of the given [collection] * Returns a sequence containing all elements of original sequence and then all elements of the given [collection].
*/ */
public fun <T> Sequence<T>.plus(collection: Iterable<T>): Sequence<T> { public fun <T> Sequence<T>.plus(collection: Iterable<T>): Sequence<T> {
return sequenceOf(this, collection.sequence()).flatten() return sequenceOf(this, collection.sequence()).flatten()
@@ -836,14 +836,14 @@ public fun <T> Sequence<T>.plus(collection: Iterable<T>): Sequence<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a stream containing all elements of original stream and then all elements of the given [collection] * Returns a stream containing all elements of original stream and then all elements of the given [collection].
*/ */
public fun <T> Stream<T>.plus(collection: Iterable<T>): Stream<T> { public fun <T> Stream<T>.plus(collection: Iterable<T>): Stream<T> {
return streamOf(this, collection.stream()).flatten() return streamOf(this, collection.stream()).flatten()
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun <T> Array<out T>.plus(element: T): List<T> { public fun <T> Array<out T>.plus(element: T): List<T> {
val answer = ArrayList<T>(size()+1) val answer = ArrayList<T>(size()+1)
@@ -853,7 +853,7 @@ public fun <T> Array<out T>.plus(element: T): List<T> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun BooleanArray.plus(element: Boolean): List<Boolean> { public fun BooleanArray.plus(element: Boolean): List<Boolean> {
val answer = ArrayList<Boolean>(size()+1) val answer = ArrayList<Boolean>(size()+1)
@@ -863,7 +863,7 @@ public fun BooleanArray.plus(element: Boolean): List<Boolean> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun ByteArray.plus(element: Byte): List<Byte> { public fun ByteArray.plus(element: Byte): List<Byte> {
val answer = ArrayList<Byte>(size()+1) val answer = ArrayList<Byte>(size()+1)
@@ -873,7 +873,7 @@ public fun ByteArray.plus(element: Byte): List<Byte> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun CharArray.plus(element: Char): List<Char> { public fun CharArray.plus(element: Char): List<Char> {
val answer = ArrayList<Char>(size()+1) val answer = ArrayList<Char>(size()+1)
@@ -883,7 +883,7 @@ public fun CharArray.plus(element: Char): List<Char> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun DoubleArray.plus(element: Double): List<Double> { public fun DoubleArray.plus(element: Double): List<Double> {
val answer = ArrayList<Double>(size()+1) val answer = ArrayList<Double>(size()+1)
@@ -893,7 +893,7 @@ public fun DoubleArray.plus(element: Double): List<Double> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun FloatArray.plus(element: Float): List<Float> { public fun FloatArray.plus(element: Float): List<Float> {
val answer = ArrayList<Float>(size()+1) val answer = ArrayList<Float>(size()+1)
@@ -903,7 +903,7 @@ public fun FloatArray.plus(element: Float): List<Float> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun IntArray.plus(element: Int): List<Int> { public fun IntArray.plus(element: Int): List<Int> {
val answer = ArrayList<Int>(size()+1) val answer = ArrayList<Int>(size()+1)
@@ -913,7 +913,7 @@ public fun IntArray.plus(element: Int): List<Int> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun LongArray.plus(element: Long): List<Long> { public fun LongArray.plus(element: Long): List<Long> {
val answer = ArrayList<Long>(size()+1) val answer = ArrayList<Long>(size()+1)
@@ -923,7 +923,7 @@ public fun LongArray.plus(element: Long): List<Long> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun ShortArray.plus(element: Short): List<Short> { public fun ShortArray.plus(element: Short): List<Short> {
val answer = ArrayList<Short>(size()+1) val answer = ArrayList<Short>(size()+1)
@@ -933,7 +933,7 @@ public fun ShortArray.plus(element: Short): List<Short> {
} }
/** /**
* Returns a list containing all elements of original collection and then the given element * Returns a list containing all elements of original collection and then the given [element].
*/ */
public fun <T> Iterable<T>.plus(element: T): List<T> { public fun <T> Iterable<T>.plus(element: T): List<T> {
val answer = ArrayList<T>(collectionSizeOrNull()?.let { it + 1 } ?: 10) val answer = ArrayList<T>(collectionSizeOrNull()?.let { it + 1 } ?: 10)
@@ -943,7 +943,7 @@ public fun <T> Iterable<T>.plus(element: T): List<T> {
} }
/** /**
* Returns a sequence containing all elements of original sequence and then the given element * Returns a sequence containing all elements of original sequence and then the given [element].
*/ */
public fun <T> Sequence<T>.plus(element: T): Sequence<T> { public fun <T> Sequence<T>.plus(element: T): Sequence<T> {
return sequenceOf(this, sequenceOf(element)).flatten() return sequenceOf(this, sequenceOf(element)).flatten()
@@ -952,14 +952,14 @@ public fun <T> Sequence<T>.plus(element: T): Sequence<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a stream containing all elements of original stream and then the given element * Returns a stream containing all elements of original stream and then the given [element].
*/ */
public fun <T> Stream<T>.plus(element: T): Stream<T> { public fun <T> Stream<T>.plus(element: T): Stream<T> {
return streamOf(this, streamOf(element)).flatten() return streamOf(this, streamOf(element)).flatten()
} }
/** /**
* Returns a sequence containing all elements of original sequence and then all elements of the given [sequence] * Returns a sequence containing all elements of original sequence and then all elements of the given [sequence].
*/ */
public fun <T> Sequence<T>.plus(sequence: Sequence<T>): Sequence<T> { public fun <T> Sequence<T>.plus(sequence: Sequence<T>): Sequence<T> {
return sequenceOf(this, sequence).flatten() return sequenceOf(this, sequence).flatten()
@@ -968,7 +968,7 @@ public fun <T> Sequence<T>.plus(sequence: Sequence<T>): Sequence<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a stream containing all elements of original stream and then all elements of the given [stream] * Returns a stream containing all elements of original stream and then all elements of the given [stream].
*/ */
public fun <T> Stream<T>.plus(stream: Stream<T>): Stream<T> { public fun <T> Stream<T>.plus(stream: Stream<T>): Stream<T> {
return streamOf(this, stream).flatten() return streamOf(this, stream).flatten()
+10 -10
View File
@@ -11,54 +11,54 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.
*/ */
public fun <T : Any> Array<out T?>.requireNoNulls(): Array<out T> { public fun <T : Any> Array<out T?>.requireNoNulls(): Array<out T> {
for (element in this) { for (element in this) {
if (element == null) { if (element == null) {
throw IllegalArgumentException("null element found in $this") throw IllegalArgumentException("null element found in $this.")
} }
} }
return this as Array<out T> return this as Array<out T>
} }
/** /**
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.
*/ */
public fun <T : Any> Iterable<T?>.requireNoNulls(): Iterable<T> { public fun <T : Any> Iterable<T?>.requireNoNulls(): Iterable<T> {
for (element in this) { for (element in this) {
if (element == null) { if (element == null) {
throw IllegalArgumentException("null element found in $this") throw IllegalArgumentException("null element found in $this.")
} }
} }
return this as Iterable<T> return this as Iterable<T>
} }
/** /**
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.
*/ */
public fun <T : Any> List<T?>.requireNoNulls(): List<T> { public fun <T : Any> List<T?>.requireNoNulls(): List<T> {
for (element in this) { for (element in this) {
if (element == null) { if (element == null) {
throw IllegalArgumentException("null element found in $this") throw IllegalArgumentException("null element found in $this.")
} }
} }
return this as List<T> return this as List<T>
} }
/** /**
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.
*/ */
public fun <T : Any> Sequence<T?>.requireNoNulls(): Sequence<T> { public fun <T : Any> Sequence<T?>.requireNoNulls(): Sequence<T> {
return map { it ?: throw IllegalArgumentException("null element found in $this") } return map { it ?: throw IllegalArgumentException("null element found in $this.") }
} }
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.
*/ */
public fun <T : Any> Stream<T?>.requireNoNulls(): Stream<T> { public fun <T : Any> Stream<T?>.requireNoNulls(): Stream<T> {
return map { it ?: throw IllegalArgumentException("null element found in $this") } return map { it ?: throw IllegalArgumentException("null element found in $this.") }
} }
File diff suppressed because it is too large Load Diff
+30 -30
View File
@@ -11,7 +11,7 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfInt") platformName("averageOfInt")
public fun Iterable<Int>.average(): Double { public fun Iterable<Int>.average(): Double {
@@ -26,7 +26,7 @@ public fun Iterable<Int>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfInt") platformName("averageOfInt")
public fun Sequence<Int>.average(): Double { public fun Sequence<Int>.average(): Double {
@@ -43,7 +43,7 @@ public fun Sequence<Int>.average(): Double {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfInt") platformName("averageOfInt")
public fun Stream<Int>.average(): Double { public fun Stream<Int>.average(): Double {
@@ -58,7 +58,7 @@ public fun Stream<Int>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfInt") platformName("averageOfInt")
public fun Array<out Int>.average(): Double { public fun Array<out Int>.average(): Double {
@@ -73,7 +73,7 @@ public fun Array<out Int>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
public fun IntArray.average(): Double { public fun IntArray.average(): Double {
val iterator = iterator() val iterator = iterator()
@@ -87,7 +87,7 @@ public fun IntArray.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfLong") platformName("averageOfLong")
public fun Iterable<Long>.average(): Double { public fun Iterable<Long>.average(): Double {
@@ -102,7 +102,7 @@ public fun Iterable<Long>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfLong") platformName("averageOfLong")
public fun Sequence<Long>.average(): Double { public fun Sequence<Long>.average(): Double {
@@ -119,7 +119,7 @@ public fun Sequence<Long>.average(): Double {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfLong") platformName("averageOfLong")
public fun Stream<Long>.average(): Double { public fun Stream<Long>.average(): Double {
@@ -134,7 +134,7 @@ public fun Stream<Long>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfLong") platformName("averageOfLong")
public fun Array<out Long>.average(): Double { public fun Array<out Long>.average(): Double {
@@ -149,7 +149,7 @@ public fun Array<out Long>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
public fun LongArray.average(): Double { public fun LongArray.average(): Double {
val iterator = iterator() val iterator = iterator()
@@ -163,7 +163,7 @@ public fun LongArray.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfByte") platformName("averageOfByte")
public fun Iterable<Byte>.average(): Double { public fun Iterable<Byte>.average(): Double {
@@ -178,7 +178,7 @@ public fun Iterable<Byte>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfByte") platformName("averageOfByte")
public fun Sequence<Byte>.average(): Double { public fun Sequence<Byte>.average(): Double {
@@ -195,7 +195,7 @@ public fun Sequence<Byte>.average(): Double {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfByte") platformName("averageOfByte")
public fun Stream<Byte>.average(): Double { public fun Stream<Byte>.average(): Double {
@@ -210,7 +210,7 @@ public fun Stream<Byte>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfByte") platformName("averageOfByte")
public fun Array<out Byte>.average(): Double { public fun Array<out Byte>.average(): Double {
@@ -225,7 +225,7 @@ public fun Array<out Byte>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
public fun ByteArray.average(): Double { public fun ByteArray.average(): Double {
val iterator = iterator() val iterator = iterator()
@@ -239,7 +239,7 @@ public fun ByteArray.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfShort") platformName("averageOfShort")
public fun Iterable<Short>.average(): Double { public fun Iterable<Short>.average(): Double {
@@ -254,7 +254,7 @@ public fun Iterable<Short>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfShort") platformName("averageOfShort")
public fun Sequence<Short>.average(): Double { public fun Sequence<Short>.average(): Double {
@@ -271,7 +271,7 @@ public fun Sequence<Short>.average(): Double {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfShort") platformName("averageOfShort")
public fun Stream<Short>.average(): Double { public fun Stream<Short>.average(): Double {
@@ -286,7 +286,7 @@ public fun Stream<Short>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfShort") platformName("averageOfShort")
public fun Array<out Short>.average(): Double { public fun Array<out Short>.average(): Double {
@@ -301,7 +301,7 @@ public fun Array<out Short>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
public fun ShortArray.average(): Double { public fun ShortArray.average(): Double {
val iterator = iterator() val iterator = iterator()
@@ -315,7 +315,7 @@ public fun ShortArray.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfDouble") platformName("averageOfDouble")
public fun Iterable<Double>.average(): Double { public fun Iterable<Double>.average(): Double {
@@ -330,7 +330,7 @@ public fun Iterable<Double>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfDouble") platformName("averageOfDouble")
public fun Sequence<Double>.average(): Double { public fun Sequence<Double>.average(): Double {
@@ -347,7 +347,7 @@ public fun Sequence<Double>.average(): Double {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfDouble") platformName("averageOfDouble")
public fun Stream<Double>.average(): Double { public fun Stream<Double>.average(): Double {
@@ -362,7 +362,7 @@ public fun Stream<Double>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfDouble") platformName("averageOfDouble")
public fun Array<out Double>.average(): Double { public fun Array<out Double>.average(): Double {
@@ -377,7 +377,7 @@ public fun Array<out Double>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
public fun DoubleArray.average(): Double { public fun DoubleArray.average(): Double {
val iterator = iterator() val iterator = iterator()
@@ -391,7 +391,7 @@ public fun DoubleArray.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfFloat") platformName("averageOfFloat")
public fun Iterable<Float>.average(): Double { public fun Iterable<Float>.average(): Double {
@@ -406,7 +406,7 @@ public fun Iterable<Float>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfFloat") platformName("averageOfFloat")
public fun Sequence<Float>.average(): Double { public fun Sequence<Float>.average(): Double {
@@ -423,7 +423,7 @@ public fun Sequence<Float>.average(): Double {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfFloat") platformName("averageOfFloat")
public fun Stream<Float>.average(): Double { public fun Stream<Float>.average(): Double {
@@ -438,7 +438,7 @@ public fun Stream<Float>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
platformName("averageOfFloat") platformName("averageOfFloat")
public fun Array<out Float>.average(): Double { public fun Array<out Float>.average(): Double {
@@ -453,7 +453,7 @@ public fun Array<out Float>.average(): Double {
} }
/** /**
* Returns an average value of elements in the collection * Returns an average value of elements in the collection.
*/ */
public fun FloatArray.average(): Double { public fun FloatArray.average(): Double {
val iterator = iterator() val iterator = iterator()
+43 -43
View File
@@ -11,7 +11,7 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun <T> Array<out T>.reverse(): List<T> { public fun <T> Array<out T>.reverse(): List<T> {
val list = toArrayList() val list = toArrayList()
@@ -20,7 +20,7 @@ public fun <T> Array<out T>.reverse(): List<T> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun BooleanArray.reverse(): List<Boolean> { public fun BooleanArray.reverse(): List<Boolean> {
val list = toArrayList() val list = toArrayList()
@@ -29,7 +29,7 @@ public fun BooleanArray.reverse(): List<Boolean> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun ByteArray.reverse(): List<Byte> { public fun ByteArray.reverse(): List<Byte> {
val list = toArrayList() val list = toArrayList()
@@ -38,7 +38,7 @@ public fun ByteArray.reverse(): List<Byte> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun CharArray.reverse(): List<Char> { public fun CharArray.reverse(): List<Char> {
val list = toArrayList() val list = toArrayList()
@@ -47,7 +47,7 @@ public fun CharArray.reverse(): List<Char> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun DoubleArray.reverse(): List<Double> { public fun DoubleArray.reverse(): List<Double> {
val list = toArrayList() val list = toArrayList()
@@ -56,7 +56,7 @@ public fun DoubleArray.reverse(): List<Double> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun FloatArray.reverse(): List<Float> { public fun FloatArray.reverse(): List<Float> {
val list = toArrayList() val list = toArrayList()
@@ -65,7 +65,7 @@ public fun FloatArray.reverse(): List<Float> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun IntArray.reverse(): List<Int> { public fun IntArray.reverse(): List<Int> {
val list = toArrayList() val list = toArrayList()
@@ -74,7 +74,7 @@ public fun IntArray.reverse(): List<Int> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun LongArray.reverse(): List<Long> { public fun LongArray.reverse(): List<Long> {
val list = toArrayList() val list = toArrayList()
@@ -83,7 +83,7 @@ public fun LongArray.reverse(): List<Long> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun ShortArray.reverse(): List<Short> { public fun ShortArray.reverse(): List<Short> {
val list = toArrayList() val list = toArrayList()
@@ -92,7 +92,7 @@ public fun ShortArray.reverse(): List<Short> {
} }
/** /**
* Returns a list with elements in reversed order * Returns a list with elements in reversed order.
*/ */
public fun <T> Iterable<T>.reverse(): List<T> { public fun <T> Iterable<T>.reverse(): List<T> {
val list = toArrayList() val list = toArrayList()
@@ -101,14 +101,14 @@ public fun <T> Iterable<T>.reverse(): List<T> {
} }
/** /**
* Returns a string with characters in reversed order * Returns a string with characters in reversed order.
*/ */
public fun String.reverse(): String { public fun String.reverse(): String {
return StringBuilder().append(this).reverse().toString() return StringBuilder().append(this).reverse().toString()
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun <T : Comparable<T>> Iterable<T>.sort(): List<T> { public fun <T : Comparable<T>> Iterable<T>.sort(): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -117,7 +117,7 @@ public fun <T : Comparable<T>> Iterable<T>.sort(): List<T> {
} }
/** /**
* Returns a list of all elements, sorted by the specified *comparator* * Returns a list of all elements, sorted by the specified [comparator].
*/ */
public fun <T> Array<out T>.sortBy(comparator: Comparator<in T>): List<T> { public fun <T> Array<out T>.sortBy(comparator: Comparator<in T>): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -126,7 +126,7 @@ public fun <T> Array<out T>.sortBy(comparator: Comparator<in T>): List<T> {
} }
/** /**
* Returns a list of all elements, sorted by the specified *comparator* * Returns a list of all elements, sorted by the specified [comparator].
*/ */
public fun <T> Iterable<T>.sortBy(comparator: Comparator<in T>): List<T> { public fun <T> Iterable<T>.sortBy(comparator: Comparator<in T>): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -135,7 +135,7 @@ public fun <T> Iterable<T>.sortBy(comparator: Comparator<in T>): List<T> {
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public inline fun <T, R : Comparable<R>> Array<out T>.sortBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) order: (T) -> R): List<T> { public inline fun <T, R : Comparable<R>> Array<out T>.sortBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) order: (T) -> R): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -145,7 +145,7 @@ public inline fun <T, R : Comparable<R>> Array<out T>.sortBy(inlineOptions(Inlin
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public inline fun <T, R : Comparable<R>> Iterable<T>.sortBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) order: (T) -> R): List<T> { public inline fun <T, R : Comparable<R>> Iterable<T>.sortBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) order: (T) -> R): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -155,7 +155,7 @@ public inline fun <T, R : Comparable<R>> Iterable<T>.sortBy(inlineOptions(Inline
} }
/** /**
* Returns a sorted list of all elements, in descending order * Returns a sorted list of all elements, in descending order.
*/ */
public fun <T : Comparable<T>> Iterable<T>.sortDescending(): List<T> { public fun <T : Comparable<T>> Iterable<T>.sortDescending(): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -164,7 +164,7 @@ public fun <T : Comparable<T>> Iterable<T>.sortDescending(): List<T> {
} }
/** /**
* Returns a sorted list of all elements, in descending order by results of specified *order* function. * Returns a sorted list of all elements, in descending order by results of specified [order] function.
*/ */
public inline fun <T, R : Comparable<R>> Array<out T>.sortDescendingBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) order: (T) -> R): List<T> { public inline fun <T, R : Comparable<R>> Array<out T>.sortDescendingBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) order: (T) -> R): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -174,7 +174,7 @@ public inline fun <T, R : Comparable<R>> Array<out T>.sortDescendingBy(inlineOpt
} }
/** /**
* Returns a sorted list of all elements, in descending order by results of specified *order* function. * Returns a sorted list of all elements, in descending order by results of specified [order] function.
*/ */
public inline fun <T, R : Comparable<R>> Iterable<T>.sortDescendingBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) order: (T) -> R): List<T> { public inline fun <T, R : Comparable<R>> Iterable<T>.sortDescendingBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) order: (T) -> R): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -184,7 +184,7 @@ public inline fun <T, R : Comparable<R>> Iterable<T>.sortDescendingBy(inlineOpti
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun <T : Comparable<T>> Array<out T>.toSortedList(): List<T> { public fun <T : Comparable<T>> Array<out T>.toSortedList(): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -193,7 +193,7 @@ public fun <T : Comparable<T>> Array<out T>.toSortedList(): List<T> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun BooleanArray.toSortedList(): List<Boolean> { public fun BooleanArray.toSortedList(): List<Boolean> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -202,7 +202,7 @@ public fun BooleanArray.toSortedList(): List<Boolean> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun ByteArray.toSortedList(): List<Byte> { public fun ByteArray.toSortedList(): List<Byte> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -211,7 +211,7 @@ public fun ByteArray.toSortedList(): List<Byte> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun CharArray.toSortedList(): List<Char> { public fun CharArray.toSortedList(): List<Char> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -220,7 +220,7 @@ public fun CharArray.toSortedList(): List<Char> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun DoubleArray.toSortedList(): List<Double> { public fun DoubleArray.toSortedList(): List<Double> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -229,7 +229,7 @@ public fun DoubleArray.toSortedList(): List<Double> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun FloatArray.toSortedList(): List<Float> { public fun FloatArray.toSortedList(): List<Float> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -238,7 +238,7 @@ public fun FloatArray.toSortedList(): List<Float> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun IntArray.toSortedList(): List<Int> { public fun IntArray.toSortedList(): List<Int> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -247,7 +247,7 @@ public fun IntArray.toSortedList(): List<Int> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun LongArray.toSortedList(): List<Long> { public fun LongArray.toSortedList(): List<Long> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -256,7 +256,7 @@ public fun LongArray.toSortedList(): List<Long> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun ShortArray.toSortedList(): List<Short> { public fun ShortArray.toSortedList(): List<Short> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -265,7 +265,7 @@ public fun ShortArray.toSortedList(): List<Short> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun <T : Comparable<T>> Iterable<T>.toSortedList(): List<T> { public fun <T : Comparable<T>> Iterable<T>.toSortedList(): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -274,7 +274,7 @@ public fun <T : Comparable<T>> Iterable<T>.toSortedList(): List<T> {
} }
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun <T : Comparable<T>> Sequence<T>.toSortedList(): List<T> { public fun <T : Comparable<T>> Sequence<T>.toSortedList(): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -285,7 +285,7 @@ public fun <T : Comparable<T>> Sequence<T>.toSortedList(): List<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a sorted list of all elements * Returns a sorted list of all elements.
*/ */
public fun <T : Comparable<T>> Stream<T>.toSortedList(): List<T> { public fun <T : Comparable<T>> Stream<T>.toSortedList(): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -294,7 +294,7 @@ public fun <T : Comparable<T>> Stream<T>.toSortedList(): List<T> {
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <T, V : Comparable<V>> Array<out T>.toSortedListBy(order: (T) -> V): List<T> { public fun <T, V : Comparable<V>> Array<out T>.toSortedListBy(order: (T) -> V): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -304,7 +304,7 @@ public fun <T, V : Comparable<V>> Array<out T>.toSortedListBy(order: (T) -> V):
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <V : Comparable<V>> BooleanArray.toSortedListBy(order: (Boolean) -> V): List<Boolean> { public fun <V : Comparable<V>> BooleanArray.toSortedListBy(order: (Boolean) -> V): List<Boolean> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -314,7 +314,7 @@ public fun <V : Comparable<V>> BooleanArray.toSortedListBy(order: (Boolean) -> V
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <V : Comparable<V>> ByteArray.toSortedListBy(order: (Byte) -> V): List<Byte> { public fun <V : Comparable<V>> ByteArray.toSortedListBy(order: (Byte) -> V): List<Byte> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -324,7 +324,7 @@ public fun <V : Comparable<V>> ByteArray.toSortedListBy(order: (Byte) -> V): Lis
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <V : Comparable<V>> CharArray.toSortedListBy(order: (Char) -> V): List<Char> { public fun <V : Comparable<V>> CharArray.toSortedListBy(order: (Char) -> V): List<Char> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -334,7 +334,7 @@ public fun <V : Comparable<V>> CharArray.toSortedListBy(order: (Char) -> V): Lis
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <V : Comparable<V>> DoubleArray.toSortedListBy(order: (Double) -> V): List<Double> { public fun <V : Comparable<V>> DoubleArray.toSortedListBy(order: (Double) -> V): List<Double> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -344,7 +344,7 @@ public fun <V : Comparable<V>> DoubleArray.toSortedListBy(order: (Double) -> V):
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <V : Comparable<V>> FloatArray.toSortedListBy(order: (Float) -> V): List<Float> { public fun <V : Comparable<V>> FloatArray.toSortedListBy(order: (Float) -> V): List<Float> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -354,7 +354,7 @@ public fun <V : Comparable<V>> FloatArray.toSortedListBy(order: (Float) -> V): L
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <V : Comparable<V>> IntArray.toSortedListBy(order: (Int) -> V): List<Int> { public fun <V : Comparable<V>> IntArray.toSortedListBy(order: (Int) -> V): List<Int> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -364,7 +364,7 @@ public fun <V : Comparable<V>> IntArray.toSortedListBy(order: (Int) -> V): List<
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <V : Comparable<V>> LongArray.toSortedListBy(order: (Long) -> V): List<Long> { public fun <V : Comparable<V>> LongArray.toSortedListBy(order: (Long) -> V): List<Long> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -374,7 +374,7 @@ public fun <V : Comparable<V>> LongArray.toSortedListBy(order: (Long) -> V): Lis
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <V : Comparable<V>> ShortArray.toSortedListBy(order: (Short) -> V): List<Short> { public fun <V : Comparable<V>> ShortArray.toSortedListBy(order: (Short) -> V): List<Short> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -384,7 +384,7 @@ public fun <V : Comparable<V>> ShortArray.toSortedListBy(order: (Short) -> V): L
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <T, V : Comparable<V>> Iterable<T>.toSortedListBy(order: (T) -> V): List<T> { public fun <T, V : Comparable<V>> Iterable<T>.toSortedListBy(order: (T) -> V): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -394,7 +394,7 @@ public fun <T, V : Comparable<V>> Iterable<T>.toSortedListBy(order: (T) -> V): L
} }
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <T, V : Comparable<V>> Sequence<T>.toSortedListBy(order: (T) -> V): List<T> { public fun <T, V : Comparable<V>> Sequence<T>.toSortedListBy(order: (T) -> V): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
@@ -406,7 +406,7 @@ public fun <T, V : Comparable<V>> Sequence<T>.toSortedListBy(order: (T) -> V): L
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a sorted list of all elements, ordered by results of specified *order* function. * Returns a sorted list of all elements, ordered by results of specified [order] function.
*/ */
public fun <T, V : Comparable<V>> Stream<T>.toSortedListBy(order: (T) -> V): List<T> { public fun <T, V : Comparable<V>> Stream<T>.toSortedListBy(order: (T) -> V): List<T> {
val sortedList = toArrayList() val sortedList = toArrayList()
+30 -30
View File
@@ -11,105 +11,105 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns a progression that goes over the same range in the opposite direction with the same step * Returns a progression that goes over the same range in the opposite direction with the same step.
*/ */
public fun ByteProgression.reversed(): ByteProgression { public fun ByteProgression.reversed(): ByteProgression {
return ByteProgression(end, start, -increment) return ByteProgression(end, start, -increment)
} }
/** /**
* Returns a progression that goes over the same range in the opposite direction with the same step * Returns a progression that goes over the same range in the opposite direction with the same step.
*/ */
public fun CharProgression.reversed(): CharProgression { public fun CharProgression.reversed(): CharProgression {
return CharProgression(end, start, -increment) return CharProgression(end, start, -increment)
} }
/** /**
* Returns a progression that goes over the same range in the opposite direction with the same step * Returns a progression that goes over the same range in the opposite direction with the same step.
*/ */
public fun DoubleProgression.reversed(): DoubleProgression { public fun DoubleProgression.reversed(): DoubleProgression {
return DoubleProgression(end, start, -increment) return DoubleProgression(end, start, -increment)
} }
/** /**
* Returns a progression that goes over the same range in the opposite direction with the same step * Returns a progression that goes over the same range in the opposite direction with the same step.
*/ */
public fun FloatProgression.reversed(): FloatProgression { public fun FloatProgression.reversed(): FloatProgression {
return FloatProgression(end, start, -increment) return FloatProgression(end, start, -increment)
} }
/** /**
* Returns a progression that goes over the same range in the opposite direction with the same step * Returns a progression that goes over the same range in the opposite direction with the same step.
*/ */
public fun IntProgression.reversed(): IntProgression { public fun IntProgression.reversed(): IntProgression {
return IntProgression(end, start, -increment) return IntProgression(end, start, -increment)
} }
/** /**
* Returns a progression that goes over the same range in the opposite direction with the same step * Returns a progression that goes over the same range in the opposite direction with the same step.
*/ */
public fun LongProgression.reversed(): LongProgression { public fun LongProgression.reversed(): LongProgression {
return LongProgression(end, start, -increment) return LongProgression(end, start, -increment)
} }
/** /**
* Returns a progression that goes over the same range in the opposite direction with the same step * Returns a progression that goes over the same range in the opposite direction with the same step.
*/ */
public fun ShortProgression.reversed(): ShortProgression { public fun ShortProgression.reversed(): ShortProgression {
return ShortProgression(end, start, -increment) return ShortProgression(end, start, -increment)
} }
/** /**
* Returns a progression that goes over this range in reverse direction * Returns a progression that goes over this range in reverse direction.
*/ */
public fun ByteRange.reversed(): ByteProgression { public fun ByteRange.reversed(): ByteProgression {
return ByteProgression(end, start, -1) return ByteProgression(end, start, -1)
} }
/** /**
* Returns a progression that goes over this range in reverse direction * Returns a progression that goes over this range in reverse direction.
*/ */
public fun CharRange.reversed(): CharProgression { public fun CharRange.reversed(): CharProgression {
return CharProgression(end, start, -1) return CharProgression(end, start, -1)
} }
/** /**
* Returns a progression that goes over this range in reverse direction * Returns a progression that goes over this range in reverse direction.
*/ */
public fun DoubleRange.reversed(): DoubleProgression { public fun DoubleRange.reversed(): DoubleProgression {
return DoubleProgression(end, start, -1.0) return DoubleProgression(end, start, -1.0)
} }
/** /**
* Returns a progression that goes over this range in reverse direction * Returns a progression that goes over this range in reverse direction.
*/ */
public fun FloatRange.reversed(): FloatProgression { public fun FloatRange.reversed(): FloatProgression {
return FloatProgression(end, start, -1.0f) return FloatProgression(end, start, -1.0f)
} }
/** /**
* Returns a progression that goes over this range in reverse direction * Returns a progression that goes over this range in reverse direction.
*/ */
public fun IntRange.reversed(): IntProgression { public fun IntRange.reversed(): IntProgression {
return IntProgression(end, start, -1) return IntProgression(end, start, -1)
} }
/** /**
* Returns a progression that goes over this range in reverse direction * Returns a progression that goes over this range in reverse direction.
*/ */
public fun LongRange.reversed(): LongProgression { public fun LongRange.reversed(): LongProgression {
return LongProgression(end, start, -1.toLong()) return LongProgression(end, start, -1.toLong())
} }
/** /**
* Returns a progression that goes over this range in reverse direction * Returns a progression that goes over this range in reverse direction.
*/ */
public fun ShortRange.reversed(): ShortProgression { public fun ShortRange.reversed(): ShortProgression {
return ShortProgression(end, start, -1) return ShortProgression(end, start, -1)
} }
/** /**
* Returns a progression that goes over the same range with the given step * Returns a progression that goes over the same range with the given step.
*/ */
public fun ByteProgression.step(step: Int): ByteProgression { public fun ByteProgression.step(step: Int): ByteProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -117,7 +117,7 @@ public fun ByteProgression.step(step: Int): ByteProgression {
} }
/** /**
* Returns a progression that goes over the same range with the given step * Returns a progression that goes over the same range with the given step.
*/ */
public fun CharProgression.step(step: Int): CharProgression { public fun CharProgression.step(step: Int): CharProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -125,7 +125,7 @@ public fun CharProgression.step(step: Int): CharProgression {
} }
/** /**
* Returns a progression that goes over the same range with the given step * Returns a progression that goes over the same range with the given step.
*/ */
public fun DoubleProgression.step(step: Double): DoubleProgression { public fun DoubleProgression.step(step: Double): DoubleProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -133,7 +133,7 @@ public fun DoubleProgression.step(step: Double): DoubleProgression {
} }
/** /**
* Returns a progression that goes over the same range with the given step * Returns a progression that goes over the same range with the given step.
*/ */
public fun FloatProgression.step(step: Float): FloatProgression { public fun FloatProgression.step(step: Float): FloatProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -141,7 +141,7 @@ public fun FloatProgression.step(step: Float): FloatProgression {
} }
/** /**
* Returns a progression that goes over the same range with the given step * Returns a progression that goes over the same range with the given step.
*/ */
public fun IntProgression.step(step: Int): IntProgression { public fun IntProgression.step(step: Int): IntProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -149,7 +149,7 @@ public fun IntProgression.step(step: Int): IntProgression {
} }
/** /**
* Returns a progression that goes over the same range with the given step * Returns a progression that goes over the same range with the given step.
*/ */
public fun LongProgression.step(step: Long): LongProgression { public fun LongProgression.step(step: Long): LongProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -157,7 +157,7 @@ public fun LongProgression.step(step: Long): LongProgression {
} }
/** /**
* Returns a progression that goes over the same range with the given step * Returns a progression that goes over the same range with the given step.
*/ */
public fun ShortProgression.step(step: Int): ShortProgression { public fun ShortProgression.step(step: Int): ShortProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -165,7 +165,7 @@ public fun ShortProgression.step(step: Int): ShortProgression {
} }
/** /**
* Returns a progression that goes over this range with given step * Returns a progression that goes over this range with given step.
*/ */
public fun ByteRange.step(step: Int): ByteProgression { public fun ByteRange.step(step: Int): ByteProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -173,7 +173,7 @@ public fun ByteRange.step(step: Int): ByteProgression {
} }
/** /**
* Returns a progression that goes over this range with given step * Returns a progression that goes over this range with given step.
*/ */
public fun CharRange.step(step: Int): CharProgression { public fun CharRange.step(step: Int): CharProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -181,25 +181,25 @@ public fun CharRange.step(step: Int): CharProgression {
} }
/** /**
* Returns a progression that goes over this range with given step * Returns a progression that goes over this range with given step.
*/ */
public fun DoubleRange.step(step: Double): DoubleProgression { public fun DoubleRange.step(step: Double): DoubleProgression {
if (step.isNaN()) throw IllegalArgumentException("Step must not be NaN") if (step.isNaN()) throw IllegalArgumentException("Step must not be NaN.")
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
return DoubleProgression(start, end, step) return DoubleProgression(start, end, step)
} }
/** /**
* Returns a progression that goes over this range with given step * Returns a progression that goes over this range with given step.
*/ */
public fun FloatRange.step(step: Float): FloatProgression { public fun FloatRange.step(step: Float): FloatProgression {
if (step.isNaN()) throw IllegalArgumentException("Step must not be NaN") if (step.isNaN()) throw IllegalArgumentException("Step must not be NaN.")
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
return FloatProgression(start, end, step) return FloatProgression(start, end, step)
} }
/** /**
* Returns a progression that goes over this range with given step * Returns a progression that goes over this range with given step.
*/ */
public fun IntRange.step(step: Int): IntProgression { public fun IntRange.step(step: Int): IntProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -207,7 +207,7 @@ public fun IntRange.step(step: Int): IntProgression {
} }
/** /**
* Returns a progression that goes over this range with given step * Returns a progression that goes over this range with given step.
*/ */
public fun LongRange.step(step: Long): LongProgression { public fun LongRange.step(step: Long): LongProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
@@ -215,7 +215,7 @@ public fun LongRange.step(step: Long): LongProgression {
} }
/** /**
* Returns a progression that goes over this range with given step * Returns a progression that goes over this range with given step.
*/ */
public fun ShortRange.step(step: Int): ShortProgression { public fun ShortRange.step(step: Int): ShortProgression {
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
+14 -14
View File
@@ -11,7 +11,7 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun <T> Array<out T>.asSequence(): Sequence<T> { public fun <T> Array<out T>.asSequence(): Sequence<T> {
return object : Sequence<T> { return object : Sequence<T> {
@@ -22,7 +22,7 @@ public fun <T> Array<out T>.asSequence(): Sequence<T> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun BooleanArray.asSequence(): Sequence<Boolean> { public fun BooleanArray.asSequence(): Sequence<Boolean> {
return object : Sequence<Boolean> { return object : Sequence<Boolean> {
@@ -33,7 +33,7 @@ public fun BooleanArray.asSequence(): Sequence<Boolean> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun ByteArray.asSequence(): Sequence<Byte> { public fun ByteArray.asSequence(): Sequence<Byte> {
return object : Sequence<Byte> { return object : Sequence<Byte> {
@@ -44,7 +44,7 @@ public fun ByteArray.asSequence(): Sequence<Byte> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun CharArray.asSequence(): Sequence<Char> { public fun CharArray.asSequence(): Sequence<Char> {
return object : Sequence<Char> { return object : Sequence<Char> {
@@ -55,7 +55,7 @@ public fun CharArray.asSequence(): Sequence<Char> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun DoubleArray.asSequence(): Sequence<Double> { public fun DoubleArray.asSequence(): Sequence<Double> {
return object : Sequence<Double> { return object : Sequence<Double> {
@@ -66,7 +66,7 @@ public fun DoubleArray.asSequence(): Sequence<Double> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun FloatArray.asSequence(): Sequence<Float> { public fun FloatArray.asSequence(): Sequence<Float> {
return object : Sequence<Float> { return object : Sequence<Float> {
@@ -77,7 +77,7 @@ public fun FloatArray.asSequence(): Sequence<Float> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun IntArray.asSequence(): Sequence<Int> { public fun IntArray.asSequence(): Sequence<Int> {
return object : Sequence<Int> { return object : Sequence<Int> {
@@ -88,7 +88,7 @@ public fun IntArray.asSequence(): Sequence<Int> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun LongArray.asSequence(): Sequence<Long> { public fun LongArray.asSequence(): Sequence<Long> {
return object : Sequence<Long> { return object : Sequence<Long> {
@@ -99,7 +99,7 @@ public fun LongArray.asSequence(): Sequence<Long> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun ShortArray.asSequence(): Sequence<Short> { public fun ShortArray.asSequence(): Sequence<Short> {
return object : Sequence<Short> { return object : Sequence<Short> {
@@ -110,7 +110,7 @@ public fun ShortArray.asSequence(): Sequence<Short> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun <T> Iterable<T>.asSequence(): Sequence<T> { public fun <T> Iterable<T>.asSequence(): Sequence<T> {
return object : Sequence<T> { return object : Sequence<T> {
@@ -121,7 +121,7 @@ public fun <T> Iterable<T>.asSequence(): Sequence<T> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun <K, V> Map<K, V>.asSequence(): Sequence<Map.Entry<K, V>> { public fun <K, V> Map<K, V>.asSequence(): Sequence<Map.Entry<K, V>> {
return object : Sequence<Map.Entry<K, V>> { return object : Sequence<Map.Entry<K, V>> {
@@ -132,7 +132,7 @@ public fun <K, V> Map<K, V>.asSequence(): Sequence<Map.Entry<K, V>> {
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun <T> Sequence<T>.asSequence(): Sequence<T> { public fun <T> Sequence<T>.asSequence(): Sequence<T> {
return this return this
@@ -141,14 +141,14 @@ public fun <T> Sequence<T>.asSequence(): Sequence<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a stream from the given collection * Returns a stream from the given collection.
*/ */
public fun <T> Stream<T>.asStream(): Stream<T> { public fun <T> Stream<T>.asStream(): Stream<T> {
return this return this
} }
/** /**
* Returns a sequence from the given collection * Returns a sequence from the given collection.
*/ */
public fun String.asSequence(): Sequence<Char> { public fun String.asSequence(): Sequence<Char> {
return object : Sequence<Char> { return object : Sequence<Char> {
+119 -119
View File
@@ -11,14 +11,14 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun <T> Array<out T>.toArrayList(): ArrayList<T> { public fun <T> Array<out T>.toArrayList(): ArrayList<T> {
return this.asList().toArrayList() return this.asList().toArrayList()
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun BooleanArray.toArrayList(): ArrayList<Boolean> { public fun BooleanArray.toArrayList(): ArrayList<Boolean> {
val list = ArrayList<Boolean>(size()) val list = ArrayList<Boolean>(size())
@@ -27,7 +27,7 @@ public fun BooleanArray.toArrayList(): ArrayList<Boolean> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun ByteArray.toArrayList(): ArrayList<Byte> { public fun ByteArray.toArrayList(): ArrayList<Byte> {
val list = ArrayList<Byte>(size()) val list = ArrayList<Byte>(size())
@@ -36,7 +36,7 @@ public fun ByteArray.toArrayList(): ArrayList<Byte> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun CharArray.toArrayList(): ArrayList<Char> { public fun CharArray.toArrayList(): ArrayList<Char> {
val list = ArrayList<Char>(size()) val list = ArrayList<Char>(size())
@@ -45,7 +45,7 @@ public fun CharArray.toArrayList(): ArrayList<Char> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun DoubleArray.toArrayList(): ArrayList<Double> { public fun DoubleArray.toArrayList(): ArrayList<Double> {
val list = ArrayList<Double>(size()) val list = ArrayList<Double>(size())
@@ -54,7 +54,7 @@ public fun DoubleArray.toArrayList(): ArrayList<Double> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun FloatArray.toArrayList(): ArrayList<Float> { public fun FloatArray.toArrayList(): ArrayList<Float> {
val list = ArrayList<Float>(size()) val list = ArrayList<Float>(size())
@@ -63,7 +63,7 @@ public fun FloatArray.toArrayList(): ArrayList<Float> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun IntArray.toArrayList(): ArrayList<Int> { public fun IntArray.toArrayList(): ArrayList<Int> {
val list = ArrayList<Int>(size()) val list = ArrayList<Int>(size())
@@ -72,7 +72,7 @@ public fun IntArray.toArrayList(): ArrayList<Int> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun LongArray.toArrayList(): ArrayList<Long> { public fun LongArray.toArrayList(): ArrayList<Long> {
val list = ArrayList<Long>(size()) val list = ArrayList<Long>(size())
@@ -81,7 +81,7 @@ public fun LongArray.toArrayList(): ArrayList<Long> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun ShortArray.toArrayList(): ArrayList<Short> { public fun ShortArray.toArrayList(): ArrayList<Short> {
val list = ArrayList<Short>(size()) val list = ArrayList<Short>(size())
@@ -90,14 +90,14 @@ public fun ShortArray.toArrayList(): ArrayList<Short> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun <T> Collection<T>.toArrayList(): ArrayList<T> { public fun <T> Collection<T>.toArrayList(): ArrayList<T> {
return ArrayList(this) return ArrayList(this)
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun <T> Iterable<T>.toArrayList(): ArrayList<T> { public fun <T> Iterable<T>.toArrayList(): ArrayList<T> {
if (this is Collection<T>) if (this is Collection<T>)
@@ -106,7 +106,7 @@ public fun <T> Iterable<T>.toArrayList(): ArrayList<T> {
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun <T> Sequence<T>.toArrayList(): ArrayList<T> { public fun <T> Sequence<T>.toArrayList(): ArrayList<T> {
return toCollection(ArrayList<T>()) return toCollection(ArrayList<T>())
@@ -115,21 +115,21 @@ public fun <T> Sequence<T>.toArrayList(): ArrayList<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun <T> Stream<T>.toArrayList(): ArrayList<T> { public fun <T> Stream<T>.toArrayList(): ArrayList<T> {
return toCollection(ArrayList<T>()) return toCollection(ArrayList<T>())
} }
/** /**
* Returns an ArrayList of all elements * Returns an [ArrayList] of all elements.
*/ */
public fun String.toArrayList(): ArrayList<Char> { public fun String.toArrayList(): ArrayList<Char> {
return toCollection(ArrayList<Char>(length())) return toCollection(ArrayList<Char>(length()))
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <T, C : MutableCollection<in T>> Array<out T>.toCollection(collection: C): C { public fun <T, C : MutableCollection<in T>> Array<out T>.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -139,7 +139,7 @@ public fun <T, C : MutableCollection<in T>> Array<out T>.toCollection(collection
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Boolean>> BooleanArray.toCollection(collection: C): C { public fun <C : MutableCollection<in Boolean>> BooleanArray.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -149,7 +149,7 @@ public fun <C : MutableCollection<in Boolean>> BooleanArray.toCollection(collect
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Byte>> ByteArray.toCollection(collection: C): C { public fun <C : MutableCollection<in Byte>> ByteArray.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -159,7 +159,7 @@ public fun <C : MutableCollection<in Byte>> ByteArray.toCollection(collection: C
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Char>> CharArray.toCollection(collection: C): C { public fun <C : MutableCollection<in Char>> CharArray.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -169,7 +169,7 @@ public fun <C : MutableCollection<in Char>> CharArray.toCollection(collection: C
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Double>> DoubleArray.toCollection(collection: C): C { public fun <C : MutableCollection<in Double>> DoubleArray.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -179,7 +179,7 @@ public fun <C : MutableCollection<in Double>> DoubleArray.toCollection(collectio
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Float>> FloatArray.toCollection(collection: C): C { public fun <C : MutableCollection<in Float>> FloatArray.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -189,7 +189,7 @@ public fun <C : MutableCollection<in Float>> FloatArray.toCollection(collection:
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Int>> IntArray.toCollection(collection: C): C { public fun <C : MutableCollection<in Int>> IntArray.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -199,7 +199,7 @@ public fun <C : MutableCollection<in Int>> IntArray.toCollection(collection: C):
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Long>> LongArray.toCollection(collection: C): C { public fun <C : MutableCollection<in Long>> LongArray.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -209,7 +209,7 @@ public fun <C : MutableCollection<in Long>> LongArray.toCollection(collection: C
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Short>> ShortArray.toCollection(collection: C): C { public fun <C : MutableCollection<in Short>> ShortArray.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -219,7 +219,7 @@ public fun <C : MutableCollection<in Short>> ShortArray.toCollection(collection:
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <T, C : MutableCollection<in T>> Iterable<T>.toCollection(collection: C): C { public fun <T, C : MutableCollection<in T>> Iterable<T>.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -229,7 +229,7 @@ public fun <T, C : MutableCollection<in T>> Iterable<T>.toCollection(collection:
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <T, C : MutableCollection<in T>> Sequence<T>.toCollection(collection: C): C { public fun <T, C : MutableCollection<in T>> Sequence<T>.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -241,7 +241,7 @@ public fun <T, C : MutableCollection<in T>> Sequence<T>.toCollection(collection:
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <T, C : MutableCollection<in T>> Stream<T>.toCollection(collection: C): C { public fun <T, C : MutableCollection<in T>> Stream<T>.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -251,7 +251,7 @@ public fun <T, C : MutableCollection<in T>> Stream<T>.toCollection(collection: C
} }
/** /**
* Appends all elements to the given *collection* * Appends all elements to the given [collection].
*/ */
public fun <C : MutableCollection<in Char>> String.toCollection(collection: C): C { public fun <C : MutableCollection<in Char>> String.toCollection(collection: C): C {
for (item in this) { for (item in this) {
@@ -261,77 +261,77 @@ public fun <C : MutableCollection<in Char>> String.toCollection(collection: C):
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun <T> Array<out T>.toHashSet(): HashSet<T> { public fun <T> Array<out T>.toHashSet(): HashSet<T> {
return toCollection(HashSet<T>(mapCapacity(size()))) return toCollection(HashSet<T>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun BooleanArray.toHashSet(): HashSet<Boolean> { public fun BooleanArray.toHashSet(): HashSet<Boolean> {
return toCollection(HashSet<Boolean>(mapCapacity(size()))) return toCollection(HashSet<Boolean>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun ByteArray.toHashSet(): HashSet<Byte> { public fun ByteArray.toHashSet(): HashSet<Byte> {
return toCollection(HashSet<Byte>(mapCapacity(size()))) return toCollection(HashSet<Byte>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun CharArray.toHashSet(): HashSet<Char> { public fun CharArray.toHashSet(): HashSet<Char> {
return toCollection(HashSet<Char>(mapCapacity(size()))) return toCollection(HashSet<Char>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun DoubleArray.toHashSet(): HashSet<Double> { public fun DoubleArray.toHashSet(): HashSet<Double> {
return toCollection(HashSet<Double>(mapCapacity(size()))) return toCollection(HashSet<Double>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun FloatArray.toHashSet(): HashSet<Float> { public fun FloatArray.toHashSet(): HashSet<Float> {
return toCollection(HashSet<Float>(mapCapacity(size()))) return toCollection(HashSet<Float>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun IntArray.toHashSet(): HashSet<Int> { public fun IntArray.toHashSet(): HashSet<Int> {
return toCollection(HashSet<Int>(mapCapacity(size()))) return toCollection(HashSet<Int>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun LongArray.toHashSet(): HashSet<Long> { public fun LongArray.toHashSet(): HashSet<Long> {
return toCollection(HashSet<Long>(mapCapacity(size()))) return toCollection(HashSet<Long>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun ShortArray.toHashSet(): HashSet<Short> { public fun ShortArray.toHashSet(): HashSet<Short> {
return toCollection(HashSet<Short>(mapCapacity(size()))) return toCollection(HashSet<Short>(mapCapacity(size())))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun <T> Iterable<T>.toHashSet(): HashSet<T> { public fun <T> Iterable<T>.toHashSet(): HashSet<T> {
return toCollection(HashSet<T>(mapCapacity(collectionSizeOrDefault(12)))) return toCollection(HashSet<T>(mapCapacity(collectionSizeOrDefault(12))))
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun <T> Sequence<T>.toHashSet(): HashSet<T> { public fun <T> Sequence<T>.toHashSet(): HashSet<T> {
return toCollection(HashSet<T>()) return toCollection(HashSet<T>())
@@ -340,91 +340,91 @@ public fun <T> Sequence<T>.toHashSet(): HashSet<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun <T> Stream<T>.toHashSet(): HashSet<T> { public fun <T> Stream<T>.toHashSet(): HashSet<T> {
return toCollection(HashSet<T>()) return toCollection(HashSet<T>())
} }
/** /**
* Returns a HashSet of all elements * Returns a [HashSet] of all elements.
*/ */
public fun String.toHashSet(): HashSet<Char> { public fun String.toHashSet(): HashSet<Char> {
return toCollection(HashSet<Char>(mapCapacity(length()))) return toCollection(HashSet<Char>(mapCapacity(length())))
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun <T> Array<out T>.toLinkedList(): LinkedList<T> { public fun <T> Array<out T>.toLinkedList(): LinkedList<T> {
return toCollection(LinkedList<T>()) return toCollection(LinkedList<T>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun BooleanArray.toLinkedList(): LinkedList<Boolean> { public fun BooleanArray.toLinkedList(): LinkedList<Boolean> {
return toCollection(LinkedList<Boolean>()) return toCollection(LinkedList<Boolean>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun ByteArray.toLinkedList(): LinkedList<Byte> { public fun ByteArray.toLinkedList(): LinkedList<Byte> {
return toCollection(LinkedList<Byte>()) return toCollection(LinkedList<Byte>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun CharArray.toLinkedList(): LinkedList<Char> { public fun CharArray.toLinkedList(): LinkedList<Char> {
return toCollection(LinkedList<Char>()) return toCollection(LinkedList<Char>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun DoubleArray.toLinkedList(): LinkedList<Double> { public fun DoubleArray.toLinkedList(): LinkedList<Double> {
return toCollection(LinkedList<Double>()) return toCollection(LinkedList<Double>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun FloatArray.toLinkedList(): LinkedList<Float> { public fun FloatArray.toLinkedList(): LinkedList<Float> {
return toCollection(LinkedList<Float>()) return toCollection(LinkedList<Float>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun IntArray.toLinkedList(): LinkedList<Int> { public fun IntArray.toLinkedList(): LinkedList<Int> {
return toCollection(LinkedList<Int>()) return toCollection(LinkedList<Int>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun LongArray.toLinkedList(): LinkedList<Long> { public fun LongArray.toLinkedList(): LinkedList<Long> {
return toCollection(LinkedList<Long>()) return toCollection(LinkedList<Long>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun ShortArray.toLinkedList(): LinkedList<Short> { public fun ShortArray.toLinkedList(): LinkedList<Short> {
return toCollection(LinkedList<Short>()) return toCollection(LinkedList<Short>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun <T> Iterable<T>.toLinkedList(): LinkedList<T> { public fun <T> Iterable<T>.toLinkedList(): LinkedList<T> {
return toCollection(LinkedList<T>()) return toCollection(LinkedList<T>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun <T> Sequence<T>.toLinkedList(): LinkedList<T> { public fun <T> Sequence<T>.toLinkedList(): LinkedList<T> {
return toCollection(LinkedList<T>()) return toCollection(LinkedList<T>())
@@ -433,21 +433,21 @@ public fun <T> Sequence<T>.toLinkedList(): LinkedList<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun <T> Stream<T>.toLinkedList(): LinkedList<T> { public fun <T> Stream<T>.toLinkedList(): LinkedList<T> {
return toCollection(LinkedList<T>()) return toCollection(LinkedList<T>())
} }
/** /**
* Returns a LinkedList containing all elements * Returns a [LinkedList] containing all elements.
*/ */
public fun String.toLinkedList(): LinkedList<Char> { public fun String.toLinkedList(): LinkedList<Char> {
return toCollection(LinkedList<Char>()) return toCollection(LinkedList<Char>())
} }
/** /**
* Returns a List containing all key-value pairs * Returns a [List] containing all key-value pairs.
*/ */
public fun <K, V> Map<K, V>.toList(): List<Pair<K, V>> { public fun <K, V> Map<K, V>.toList(): List<Pair<K, V>> {
val result = ArrayList<Pair<K, V>>(size()) val result = ArrayList<Pair<K, V>>(size())
@@ -457,77 +457,77 @@ public fun <K, V> Map<K, V>.toList(): List<Pair<K, V>> {
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun <T> Array<out T>.toList(): List<T> { public fun <T> Array<out T>.toList(): List<T> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun BooleanArray.toList(): List<Boolean> { public fun BooleanArray.toList(): List<Boolean> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun ByteArray.toList(): List<Byte> { public fun ByteArray.toList(): List<Byte> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun CharArray.toList(): List<Char> { public fun CharArray.toList(): List<Char> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun DoubleArray.toList(): List<Double> { public fun DoubleArray.toList(): List<Double> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun FloatArray.toList(): List<Float> { public fun FloatArray.toList(): List<Float> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun IntArray.toList(): List<Int> { public fun IntArray.toList(): List<Int> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun LongArray.toList(): List<Long> { public fun LongArray.toList(): List<Long> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun ShortArray.toList(): List<Short> { public fun ShortArray.toList(): List<Short> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun <T> Iterable<T>.toList(): List<T> { public fun <T> Iterable<T>.toList(): List<T> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun <T> Sequence<T>.toList(): List<T> { public fun <T> Sequence<T>.toList(): List<T> {
return this.toArrayList() return this.toArrayList()
@@ -536,21 +536,21 @@ public fun <T> Sequence<T>.toList(): List<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun <T> Stream<T>.toList(): List<T> { public fun <T> Stream<T>.toList(): List<T> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns a List containing all elements * Returns a [List] containing all elements.
*/ */
public fun String.toList(): List<Char> { public fun String.toList(): List<Char> {
return this.toArrayList() return this.toArrayList()
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <T, K> Array<out T>.toMap(selector: (T) -> K): Map<K, T> { public inline fun <T, K> Array<out T>.toMap(selector: (T) -> K): Map<K, T> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -562,7 +562,7 @@ public inline fun <T, K> Array<out T>.toMap(selector: (T) -> K): Map<K, T> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> BooleanArray.toMap(selector: (Boolean) -> K): Map<K, Boolean> { public inline fun <K> BooleanArray.toMap(selector: (Boolean) -> K): Map<K, Boolean> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -574,7 +574,7 @@ public inline fun <K> BooleanArray.toMap(selector: (Boolean) -> K): Map<K, Boole
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> ByteArray.toMap(selector: (Byte) -> K): Map<K, Byte> { public inline fun <K> ByteArray.toMap(selector: (Byte) -> K): Map<K, Byte> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -586,7 +586,7 @@ public inline fun <K> ByteArray.toMap(selector: (Byte) -> K): Map<K, Byte> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> CharArray.toMap(selector: (Char) -> K): Map<K, Char> { public inline fun <K> CharArray.toMap(selector: (Char) -> K): Map<K, Char> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -598,7 +598,7 @@ public inline fun <K> CharArray.toMap(selector: (Char) -> K): Map<K, Char> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> DoubleArray.toMap(selector: (Double) -> K): Map<K, Double> { public inline fun <K> DoubleArray.toMap(selector: (Double) -> K): Map<K, Double> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -610,7 +610,7 @@ public inline fun <K> DoubleArray.toMap(selector: (Double) -> K): Map<K, Double>
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> FloatArray.toMap(selector: (Float) -> K): Map<K, Float> { public inline fun <K> FloatArray.toMap(selector: (Float) -> K): Map<K, Float> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -622,7 +622,7 @@ public inline fun <K> FloatArray.toMap(selector: (Float) -> K): Map<K, Float> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> IntArray.toMap(selector: (Int) -> K): Map<K, Int> { public inline fun <K> IntArray.toMap(selector: (Int) -> K): Map<K, Int> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -634,7 +634,7 @@ public inline fun <K> IntArray.toMap(selector: (Int) -> K): Map<K, Int> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> LongArray.toMap(selector: (Long) -> K): Map<K, Long> { public inline fun <K> LongArray.toMap(selector: (Long) -> K): Map<K, Long> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -646,7 +646,7 @@ public inline fun <K> LongArray.toMap(selector: (Long) -> K): Map<K, Long> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> ShortArray.toMap(selector: (Short) -> K): Map<K, Short> { public inline fun <K> ShortArray.toMap(selector: (Short) -> K): Map<K, Short> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -658,7 +658,7 @@ public inline fun <K> ShortArray.toMap(selector: (Short) -> K): Map<K, Short> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <T, K> Iterable<T>.toMap(selector: (T) -> K): Map<K, T> { public inline fun <T, K> Iterable<T>.toMap(selector: (T) -> K): Map<K, T> {
val capacity = (collectionSizeOrDefault(10)/.75f) + 1 val capacity = (collectionSizeOrDefault(10)/.75f) + 1
@@ -670,7 +670,7 @@ public inline fun <T, K> Iterable<T>.toMap(selector: (T) -> K): Map<K, T> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <T, K> Sequence<T>.toMap(selector: (T) -> K): Map<K, T> { public inline fun <T, K> Sequence<T>.toMap(selector: (T) -> K): Map<K, T> {
val result = LinkedHashMap<K, T>() val result = LinkedHashMap<K, T>()
@@ -683,7 +683,7 @@ public inline fun <T, K> Sequence<T>.toMap(selector: (T) -> K): Map<K, T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <T, K> Stream<T>.toMap(selector: (T) -> K): Map<K, T> { public inline fun <T, K> Stream<T>.toMap(selector: (T) -> K): Map<K, T> {
val result = LinkedHashMap<K, T>() val result = LinkedHashMap<K, T>()
@@ -694,7 +694,7 @@ public inline fun <T, K> Stream<T>.toMap(selector: (T) -> K): Map<K, T> {
} }
/** /**
* Returns Map containing all the values from the given collection indexed by *selector* * Returns Map containing all the values from the given collection indexed by [selector].
*/ */
public inline fun <K> String.toMap(selector: (Char) -> K): Map<K, Char> { public inline fun <K> String.toMap(selector: (Char) -> K): Map<K, Char> {
val capacity = (length()/.75f) + 1 val capacity = (length()/.75f) + 1
@@ -706,7 +706,7 @@ public inline fun <K> String.toMap(selector: (Char) -> K): Map<K, Char> {
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <T, K, V> Array<out T>.toMap(selector: (T) -> K, transform: (T) -> V): Map<K, V> { public inline fun <T, K, V> Array<out T>.toMap(selector: (T) -> K, transform: (T) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -718,7 +718,7 @@ public inline fun <T, K, V> Array<out T>.toMap(selector: (T) -> K, transform: (T
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> BooleanArray.toMap(selector: (Boolean) -> K, transform: (Boolean) -> V): Map<K, V> { public inline fun <K, V> BooleanArray.toMap(selector: (Boolean) -> K, transform: (Boolean) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -730,7 +730,7 @@ public inline fun <K, V> BooleanArray.toMap(selector: (Boolean) -> K, transform:
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> ByteArray.toMap(selector: (Byte) -> K, transform: (Byte) -> V): Map<K, V> { public inline fun <K, V> ByteArray.toMap(selector: (Byte) -> K, transform: (Byte) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -742,7 +742,7 @@ public inline fun <K, V> ByteArray.toMap(selector: (Byte) -> K, transform: (Byte
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> CharArray.toMap(selector: (Char) -> K, transform: (Char) -> V): Map<K, V> { public inline fun <K, V> CharArray.toMap(selector: (Char) -> K, transform: (Char) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -754,7 +754,7 @@ public inline fun <K, V> CharArray.toMap(selector: (Char) -> K, transform: (Char
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> DoubleArray.toMap(selector: (Double) -> K, transform: (Double) -> V): Map<K, V> { public inline fun <K, V> DoubleArray.toMap(selector: (Double) -> K, transform: (Double) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -766,7 +766,7 @@ public inline fun <K, V> DoubleArray.toMap(selector: (Double) -> K, transform: (
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> FloatArray.toMap(selector: (Float) -> K, transform: (Float) -> V): Map<K, V> { public inline fun <K, V> FloatArray.toMap(selector: (Float) -> K, transform: (Float) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -778,7 +778,7 @@ public inline fun <K, V> FloatArray.toMap(selector: (Float) -> K, transform: (Fl
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> IntArray.toMap(selector: (Int) -> K, transform: (Int) -> V): Map<K, V> { public inline fun <K, V> IntArray.toMap(selector: (Int) -> K, transform: (Int) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -790,7 +790,7 @@ public inline fun <K, V> IntArray.toMap(selector: (Int) -> K, transform: (Int) -
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> LongArray.toMap(selector: (Long) -> K, transform: (Long) -> V): Map<K, V> { public inline fun <K, V> LongArray.toMap(selector: (Long) -> K, transform: (Long) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -802,7 +802,7 @@ public inline fun <K, V> LongArray.toMap(selector: (Long) -> K, transform: (Long
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> ShortArray.toMap(selector: (Short) -> K, transform: (Short) -> V): Map<K, V> { public inline fun <K, V> ShortArray.toMap(selector: (Short) -> K, transform: (Short) -> V): Map<K, V> {
val capacity = (size()/.75f) + 1 val capacity = (size()/.75f) + 1
@@ -814,7 +814,7 @@ public inline fun <K, V> ShortArray.toMap(selector: (Short) -> K, transform: (Sh
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <T, K, V> Iterable<T>.toMap(selector: (T) -> K, transform: (T) -> V): Map<K, V> { public inline fun <T, K, V> Iterable<T>.toMap(selector: (T) -> K, transform: (T) -> V): Map<K, V> {
val capacity = (collectionSizeOrDefault(10)/.75f) + 1 val capacity = (collectionSizeOrDefault(10)/.75f) + 1
@@ -826,7 +826,7 @@ public inline fun <T, K, V> Iterable<T>.toMap(selector: (T) -> K, transform: (T)
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <T, K, V> Sequence<T>.toMap(selector: (T) -> K, transform: (T) -> V): Map<K, V> { public inline fun <T, K, V> Sequence<T>.toMap(selector: (T) -> K, transform: (T) -> V): Map<K, V> {
val result = LinkedHashMap<K, V>() val result = LinkedHashMap<K, V>()
@@ -839,7 +839,7 @@ public inline fun <T, K, V> Sequence<T>.toMap(selector: (T) -> K, transform: (T)
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <T, K, V> Stream<T>.toMap(selector: (T) -> K, transform: (T) -> V): Map<K, V> { public inline fun <T, K, V> Stream<T>.toMap(selector: (T) -> K, transform: (T) -> V): Map<K, V> {
val result = LinkedHashMap<K, V>() val result = LinkedHashMap<K, V>()
@@ -850,7 +850,7 @@ public inline fun <T, K, V> Stream<T>.toMap(selector: (T) -> K, transform: (T) -
} }
/** /**
* Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection * Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
*/ */
public inline fun <K, V> String.toMap(selector: (Char) -> K, transform: (Char) -> V): Map<K, V> { public inline fun <K, V> String.toMap(selector: (Char) -> K, transform: (Char) -> V): Map<K, V> {
val capacity = (length()/.75f) + 1 val capacity = (length()/.75f) + 1
@@ -862,77 +862,77 @@ public inline fun <K, V> String.toMap(selector: (Char) -> K, transform: (Char) -
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun <T> Array<out T>.toSet(): Set<T> { public fun <T> Array<out T>.toSet(): Set<T> {
return toCollection(LinkedHashSet<T>(mapCapacity(size()))) return toCollection(LinkedHashSet<T>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun BooleanArray.toSet(): Set<Boolean> { public fun BooleanArray.toSet(): Set<Boolean> {
return toCollection(LinkedHashSet<Boolean>(mapCapacity(size()))) return toCollection(LinkedHashSet<Boolean>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun ByteArray.toSet(): Set<Byte> { public fun ByteArray.toSet(): Set<Byte> {
return toCollection(LinkedHashSet<Byte>(mapCapacity(size()))) return toCollection(LinkedHashSet<Byte>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun CharArray.toSet(): Set<Char> { public fun CharArray.toSet(): Set<Char> {
return toCollection(LinkedHashSet<Char>(mapCapacity(size()))) return toCollection(LinkedHashSet<Char>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun DoubleArray.toSet(): Set<Double> { public fun DoubleArray.toSet(): Set<Double> {
return toCollection(LinkedHashSet<Double>(mapCapacity(size()))) return toCollection(LinkedHashSet<Double>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun FloatArray.toSet(): Set<Float> { public fun FloatArray.toSet(): Set<Float> {
return toCollection(LinkedHashSet<Float>(mapCapacity(size()))) return toCollection(LinkedHashSet<Float>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun IntArray.toSet(): Set<Int> { public fun IntArray.toSet(): Set<Int> {
return toCollection(LinkedHashSet<Int>(mapCapacity(size()))) return toCollection(LinkedHashSet<Int>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun LongArray.toSet(): Set<Long> { public fun LongArray.toSet(): Set<Long> {
return toCollection(LinkedHashSet<Long>(mapCapacity(size()))) return toCollection(LinkedHashSet<Long>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun ShortArray.toSet(): Set<Short> { public fun ShortArray.toSet(): Set<Short> {
return toCollection(LinkedHashSet<Short>(mapCapacity(size()))) return toCollection(LinkedHashSet<Short>(mapCapacity(size())))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun <T> Iterable<T>.toSet(): Set<T> { public fun <T> Iterable<T>.toSet(): Set<T> {
return toCollection(LinkedHashSet<T>(mapCapacity(collectionSizeOrDefault(12)))) return toCollection(LinkedHashSet<T>(mapCapacity(collectionSizeOrDefault(12))))
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun <T> Sequence<T>.toSet(): Set<T> { public fun <T> Sequence<T>.toSet(): Set<T> {
return toCollection(LinkedHashSet<T>()) return toCollection(LinkedHashSet<T>())
@@ -941,91 +941,91 @@ public fun <T> Sequence<T>.toSet(): Set<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun <T> Stream<T>.toSet(): Set<T> { public fun <T> Stream<T>.toSet(): Set<T> {
return toCollection(LinkedHashSet<T>()) return toCollection(LinkedHashSet<T>())
} }
/** /**
* Returns a Set of all elements * Returns a [Set] of all elements.
*/ */
public fun String.toSet(): Set<Char> { public fun String.toSet(): Set<Char> {
return toCollection(LinkedHashSet<Char>(mapCapacity(length()))) return toCollection(LinkedHashSet<Char>(mapCapacity(length())))
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun <T> Array<out T>.toSortedSet(): SortedSet<T> { public fun <T> Array<out T>.toSortedSet(): SortedSet<T> {
return toCollection(TreeSet<T>()) return toCollection(TreeSet<T>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun BooleanArray.toSortedSet(): SortedSet<Boolean> { public fun BooleanArray.toSortedSet(): SortedSet<Boolean> {
return toCollection(TreeSet<Boolean>()) return toCollection(TreeSet<Boolean>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun ByteArray.toSortedSet(): SortedSet<Byte> { public fun ByteArray.toSortedSet(): SortedSet<Byte> {
return toCollection(TreeSet<Byte>()) return toCollection(TreeSet<Byte>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun CharArray.toSortedSet(): SortedSet<Char> { public fun CharArray.toSortedSet(): SortedSet<Char> {
return toCollection(TreeSet<Char>()) return toCollection(TreeSet<Char>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun DoubleArray.toSortedSet(): SortedSet<Double> { public fun DoubleArray.toSortedSet(): SortedSet<Double> {
return toCollection(TreeSet<Double>()) return toCollection(TreeSet<Double>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun FloatArray.toSortedSet(): SortedSet<Float> { public fun FloatArray.toSortedSet(): SortedSet<Float> {
return toCollection(TreeSet<Float>()) return toCollection(TreeSet<Float>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun IntArray.toSortedSet(): SortedSet<Int> { public fun IntArray.toSortedSet(): SortedSet<Int> {
return toCollection(TreeSet<Int>()) return toCollection(TreeSet<Int>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun LongArray.toSortedSet(): SortedSet<Long> { public fun LongArray.toSortedSet(): SortedSet<Long> {
return toCollection(TreeSet<Long>()) return toCollection(TreeSet<Long>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun ShortArray.toSortedSet(): SortedSet<Short> { public fun ShortArray.toSortedSet(): SortedSet<Short> {
return toCollection(TreeSet<Short>()) return toCollection(TreeSet<Short>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun <T> Iterable<T>.toSortedSet(): SortedSet<T> { public fun <T> Iterable<T>.toSortedSet(): SortedSet<T> {
return toCollection(TreeSet<T>()) return toCollection(TreeSet<T>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun <T> Sequence<T>.toSortedSet(): SortedSet<T> { public fun <T> Sequence<T>.toSortedSet(): SortedSet<T> {
return toCollection(TreeSet<T>()) return toCollection(TreeSet<T>())
@@ -1034,14 +1034,14 @@ public fun <T> Sequence<T>.toSortedSet(): SortedSet<T> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun <T> Stream<T>.toSortedSet(): SortedSet<T> { public fun <T> Stream<T>.toSortedSet(): SortedSet<T> {
return toCollection(TreeSet<T>()) return toCollection(TreeSet<T>())
} }
/** /**
* Returns a SortedSet of all elements * Returns a [SortedSet] of all elements.
*/ */
public fun String.toSortedSet(): SortedSet<Char> { public fun String.toSortedSet(): SortedSet<Char> {
return toCollection(TreeSet<Char>()) return toCollection(TreeSet<Char>())
+69 -69
View File
@@ -11,14 +11,14 @@ import java.util.*
import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js import java.util.Collections // TODO: it's temporary while we have java.util.Collections in js
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun <T> Array<out T>.asList(): List<T> { public fun <T> Array<out T>.asList(): List<T> {
return Arrays.asList(*this) return Arrays.asList(*this)
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun BooleanArray.asList(): List<Boolean> { public fun BooleanArray.asList(): List<Boolean> {
return object : AbstractList<Boolean>(), RandomAccess { return object : AbstractList<Boolean>(), RandomAccess {
@@ -33,7 +33,7 @@ public fun BooleanArray.asList(): List<Boolean> {
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun ByteArray.asList(): List<Byte> { public fun ByteArray.asList(): List<Byte> {
return object : AbstractList<Byte>(), RandomAccess { return object : AbstractList<Byte>(), RandomAccess {
@@ -48,7 +48,7 @@ public fun ByteArray.asList(): List<Byte> {
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun CharArray.asList(): List<Char> { public fun CharArray.asList(): List<Char> {
return object : AbstractList<Char>(), RandomAccess { return object : AbstractList<Char>(), RandomAccess {
@@ -63,7 +63,7 @@ public fun CharArray.asList(): List<Char> {
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun DoubleArray.asList(): List<Double> { public fun DoubleArray.asList(): List<Double> {
return object : AbstractList<Double>(), RandomAccess { return object : AbstractList<Double>(), RandomAccess {
@@ -78,7 +78,7 @@ public fun DoubleArray.asList(): List<Double> {
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun FloatArray.asList(): List<Float> { public fun FloatArray.asList(): List<Float> {
return object : AbstractList<Float>(), RandomAccess { return object : AbstractList<Float>(), RandomAccess {
@@ -93,7 +93,7 @@ public fun FloatArray.asList(): List<Float> {
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun IntArray.asList(): List<Int> { public fun IntArray.asList(): List<Int> {
return object : AbstractList<Int>(), RandomAccess { return object : AbstractList<Int>(), RandomAccess {
@@ -108,7 +108,7 @@ public fun IntArray.asList(): List<Int> {
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun LongArray.asList(): List<Long> { public fun LongArray.asList(): List<Long> {
return object : AbstractList<Long>(), RandomAccess { return object : AbstractList<Long>(), RandomAccess {
@@ -123,7 +123,7 @@ public fun LongArray.asList(): List<Long> {
} }
/** /**
* Returns a list that wraps the original array * Returns a [List] that wraps the original array.
*/ */
public fun ShortArray.asList(): List<Short> { public fun ShortArray.asList(): List<Short> {
return object : AbstractList<Short>(), RandomAccess { return object : AbstractList<Short>(), RandomAccess {
@@ -194,196 +194,196 @@ public fun ShortArray.binarySearch(element: Short, fromIndex: Int = 0, toIndex:
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun <T> Array<out T>.copyOf(): Array<T> { public fun <T> Array<out T>.copyOf(): Array<T> {
return Arrays.copyOf(this, size()) as Array<T> return Arrays.copyOf(this, size()) as Array<T>
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun BooleanArray.copyOf(): BooleanArray { public fun BooleanArray.copyOf(): BooleanArray {
return Arrays.copyOf(this, size()) return Arrays.copyOf(this, size())
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun ByteArray.copyOf(): ByteArray { public fun ByteArray.copyOf(): ByteArray {
return Arrays.copyOf(this, size()) return Arrays.copyOf(this, size())
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun CharArray.copyOf(): CharArray { public fun CharArray.copyOf(): CharArray {
return Arrays.copyOf(this, size()) return Arrays.copyOf(this, size())
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun DoubleArray.copyOf(): DoubleArray { public fun DoubleArray.copyOf(): DoubleArray {
return Arrays.copyOf(this, size()) return Arrays.copyOf(this, size())
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun FloatArray.copyOf(): FloatArray { public fun FloatArray.copyOf(): FloatArray {
return Arrays.copyOf(this, size()) return Arrays.copyOf(this, size())
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun IntArray.copyOf(): IntArray { public fun IntArray.copyOf(): IntArray {
return Arrays.copyOf(this, size()) return Arrays.copyOf(this, size())
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun LongArray.copyOf(): LongArray { public fun LongArray.copyOf(): LongArray {
return Arrays.copyOf(this, size()) return Arrays.copyOf(this, size())
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun ShortArray.copyOf(): ShortArray { public fun ShortArray.copyOf(): ShortArray {
return Arrays.copyOf(this, size()) return Arrays.copyOf(this, size())
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun <T> Array<out T>.copyOf(newSize: Int): Array<T?> { public fun <T> Array<out T>.copyOf(newSize: Int): Array<T?> {
return Arrays.copyOf(this, newSize) as Array<T?> return Arrays.copyOf(this, newSize) as Array<T?>
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun BooleanArray.copyOf(newSize: Int): BooleanArray { public fun BooleanArray.copyOf(newSize: Int): BooleanArray {
return Arrays.copyOf(this, newSize) return Arrays.copyOf(this, newSize)
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun ByteArray.copyOf(newSize: Int): ByteArray { public fun ByteArray.copyOf(newSize: Int): ByteArray {
return Arrays.copyOf(this, newSize) return Arrays.copyOf(this, newSize)
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun CharArray.copyOf(newSize: Int): CharArray { public fun CharArray.copyOf(newSize: Int): CharArray {
return Arrays.copyOf(this, newSize) return Arrays.copyOf(this, newSize)
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun DoubleArray.copyOf(newSize: Int): DoubleArray { public fun DoubleArray.copyOf(newSize: Int): DoubleArray {
return Arrays.copyOf(this, newSize) return Arrays.copyOf(this, newSize)
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun FloatArray.copyOf(newSize: Int): FloatArray { public fun FloatArray.copyOf(newSize: Int): FloatArray {
return Arrays.copyOf(this, newSize) return Arrays.copyOf(this, newSize)
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun IntArray.copyOf(newSize: Int): IntArray { public fun IntArray.copyOf(newSize: Int): IntArray {
return Arrays.copyOf(this, newSize) return Arrays.copyOf(this, newSize)
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun LongArray.copyOf(newSize: Int): LongArray { public fun LongArray.copyOf(newSize: Int): LongArray {
return Arrays.copyOf(this, newSize) return Arrays.copyOf(this, newSize)
} }
/** /**
* Returns new array which is a copy of the original array * Returns new array which is a copy of the original array.
*/ */
public fun ShortArray.copyOf(newSize: Int): ShortArray { public fun ShortArray.copyOf(newSize: Int): ShortArray {
return Arrays.copyOf(this, newSize) return Arrays.copyOf(this, newSize)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun <T> Array<out T>.copyOfRange(from: Int, to: Int): Array<T> { public fun <T> Array<out T>.copyOfRange(from: Int, to: Int): Array<T> {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun BooleanArray.copyOfRange(from: Int, to: Int): BooleanArray { public fun BooleanArray.copyOfRange(from: Int, to: Int): BooleanArray {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun ByteArray.copyOfRange(from: Int, to: Int): ByteArray { public fun ByteArray.copyOfRange(from: Int, to: Int): ByteArray {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun CharArray.copyOfRange(from: Int, to: Int): CharArray { public fun CharArray.copyOfRange(from: Int, to: Int): CharArray {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun DoubleArray.copyOfRange(from: Int, to: Int): DoubleArray { public fun DoubleArray.copyOfRange(from: Int, to: Int): DoubleArray {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun FloatArray.copyOfRange(from: Int, to: Int): FloatArray { public fun FloatArray.copyOfRange(from: Int, to: Int): FloatArray {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun IntArray.copyOfRange(from: Int, to: Int): IntArray { public fun IntArray.copyOfRange(from: Int, to: Int): IntArray {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun LongArray.copyOfRange(from: Int, to: Int): LongArray { public fun LongArray.copyOfRange(from: Int, to: Int): LongArray {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Returns new array which is a copy of range of original array * Returns new array which is a copy of range of original array.
*/ */
public fun ShortArray.copyOfRange(from: Int, to: Int): ShortArray { public fun ShortArray.copyOfRange(from: Int, to: Int): ShortArray {
return Arrays.copyOfRange(this, from, to) return Arrays.copyOfRange(this, from, to)
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun <T> Array<out T>.fill(element: T): Array<out T> { public fun <T> Array<out T>.fill(element: T): Array<out T> {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -391,7 +391,7 @@ public fun <T> Array<out T>.fill(element: T): Array<out T> {
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun BooleanArray.fill(element: Boolean): BooleanArray { public fun BooleanArray.fill(element: Boolean): BooleanArray {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -399,7 +399,7 @@ public fun BooleanArray.fill(element: Boolean): BooleanArray {
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun ByteArray.fill(element: Byte): ByteArray { public fun ByteArray.fill(element: Byte): ByteArray {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -407,7 +407,7 @@ public fun ByteArray.fill(element: Byte): ByteArray {
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun CharArray.fill(element: Char): CharArray { public fun CharArray.fill(element: Char): CharArray {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -415,7 +415,7 @@ public fun CharArray.fill(element: Char): CharArray {
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun DoubleArray.fill(element: Double): DoubleArray { public fun DoubleArray.fill(element: Double): DoubleArray {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -423,7 +423,7 @@ public fun DoubleArray.fill(element: Double): DoubleArray {
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun FloatArray.fill(element: Float): FloatArray { public fun FloatArray.fill(element: Float): FloatArray {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -431,7 +431,7 @@ public fun FloatArray.fill(element: Float): FloatArray {
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun IntArray.fill(element: Int): IntArray { public fun IntArray.fill(element: Int): IntArray {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -439,7 +439,7 @@ public fun IntArray.fill(element: Int): IntArray {
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun LongArray.fill(element: Long): LongArray { public fun LongArray.fill(element: Long): LongArray {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -447,7 +447,7 @@ public fun LongArray.fill(element: Long): LongArray {
} }
/** /**
* Fills original array with the provided value * Fills original array with the provided value.
*/ */
public fun ShortArray.fill(element: Short): ShortArray { public fun ShortArray.fill(element: Short): ShortArray {
Arrays.fill(this, element) Arrays.fill(this, element)
@@ -455,21 +455,21 @@ public fun ShortArray.fill(element: Short): ShortArray {
} }
/** /**
* Returns a list containing all elements that are instances of specified type parameter R * Returns a list containing all elements that are instances of specified type parameter R.
*/ */
public inline fun <reified R> Array<*>.filterIsInstance(): List<R> { public inline fun <reified R> Array<*>.filterIsInstance(): List<R> {
return filterIsInstanceTo(ArrayList<R>()) return filterIsInstanceTo(ArrayList<R>())
} }
/** /**
* Returns a list containing all elements that are instances of specified type parameter R * Returns a list containing all elements that are instances of specified type parameter R.
*/ */
public inline fun <reified R> Iterable<*>.filterIsInstance(): List<R> { public inline fun <reified R> Iterable<*>.filterIsInstance(): List<R> {
return filterIsInstanceTo(ArrayList<R>()) return filterIsInstanceTo(ArrayList<R>())
} }
/** /**
* Returns a sequence containing all elements that are instances of specified type parameter R * Returns a sequence containing all elements that are instances of specified type parameter R.
*/ */
public inline fun <reified R> Sequence<*>.filterIsInstance(): Sequence<R> { public inline fun <reified R> Sequence<*>.filterIsInstance(): Sequence<R> {
return filter { it is R } as Sequence<R> return filter { it is R } as Sequence<R>
@@ -478,28 +478,28 @@ public inline fun <reified R> Sequence<*>.filterIsInstance(): Sequence<R> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a stream containing all elements that are instances of specified type parameter R * Returns a stream containing all elements that are instances of specified type parameter R.
*/ */
public inline fun <reified R> Stream<*>.filterIsInstance(): Stream<R> { public inline fun <reified R> Stream<*>.filterIsInstance(): Stream<R> {
return filter { it is R } as Stream<R> return filter { it is R } as Stream<R>
} }
/** /**
* Returns a list containing all elements that are instances of specified class * Returns a list containing all elements that are instances of specified class.
*/ */
public fun <R> Array<*>.filterIsInstance(klass: Class<R>): List<R> { public fun <R> Array<*>.filterIsInstance(klass: Class<R>): List<R> {
return filterIsInstanceTo(ArrayList<R>(), klass) return filterIsInstanceTo(ArrayList<R>(), klass)
} }
/** /**
* Returns a list containing all elements that are instances of specified class * Returns a list containing all elements that are instances of specified class.
*/ */
public fun <R> Iterable<*>.filterIsInstance(klass: Class<R>): List<R> { public fun <R> Iterable<*>.filterIsInstance(klass: Class<R>): List<R> {
return filterIsInstanceTo(ArrayList<R>(), klass) return filterIsInstanceTo(ArrayList<R>(), klass)
} }
/** /**
* Returns a sequence containing all elements that are instances of specified class * Returns a sequence containing all elements that are instances of specified class.
*/ */
public fun <R> Sequence<*>.filterIsInstance(klass: Class<R>): Sequence<R> { public fun <R> Sequence<*>.filterIsInstance(klass: Class<R>): Sequence<R> {
return filter { klass.isInstance(it) } as Sequence<R> return filter { klass.isInstance(it) } as Sequence<R>
@@ -508,14 +508,14 @@ public fun <R> Sequence<*>.filterIsInstance(klass: Class<R>): Sequence<R> {
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Returns a stream containing all elements that are instances of specified class * Returns a stream containing all elements that are instances of specified class.
*/ */
public fun <R> Stream<*>.filterIsInstance(klass: Class<R>): Stream<R> { public fun <R> Stream<*>.filterIsInstance(klass: Class<R>): Stream<R> {
return filter { klass.isInstance(it) } as Stream<R> return filter { klass.isInstance(it) } as Stream<R>
} }
/** /**
* Appends all elements that are instances of specified type parameter R to the given *destination* * Appends all elements that are instances of specified type parameter R to the given [destination].
*/ */
public inline fun <reified R, C : MutableCollection<in R>> Array<*>.filterIsInstanceTo(destination: C): C { public inline fun <reified R, C : MutableCollection<in R>> Array<*>.filterIsInstanceTo(destination: C): C {
for (element in this) if (element is R) destination.add(element) for (element in this) if (element is R) destination.add(element)
@@ -523,7 +523,7 @@ public inline fun <reified R, C : MutableCollection<in R>> Array<*>.filterIsInst
} }
/** /**
* Appends all elements that are instances of specified type parameter R to the given *destination* * Appends all elements that are instances of specified type parameter R to the given [destination].
*/ */
public inline fun <reified R, C : MutableCollection<in R>> Iterable<*>.filterIsInstanceTo(destination: C): C { public inline fun <reified R, C : MutableCollection<in R>> Iterable<*>.filterIsInstanceTo(destination: C): C {
for (element in this) if (element is R) destination.add(element) for (element in this) if (element is R) destination.add(element)
@@ -531,7 +531,7 @@ public inline fun <reified R, C : MutableCollection<in R>> Iterable<*>.filterIsI
} }
/** /**
* Appends all elements that are instances of specified type parameter R to the given *destination* * Appends all elements that are instances of specified type parameter R to the given [destination].
*/ */
public inline fun <reified R, C : MutableCollection<in R>> Sequence<*>.filterIsInstanceTo(destination: C): C { public inline fun <reified R, C : MutableCollection<in R>> Sequence<*>.filterIsInstanceTo(destination: C): C {
for (element in this) if (element is R) destination.add(element) for (element in this) if (element is R) destination.add(element)
@@ -541,7 +541,7 @@ public inline fun <reified R, C : MutableCollection<in R>> Sequence<*>.filterIsI
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Appends all elements that are instances of specified type parameter R to the given *destination* * Appends all elements that are instances of specified type parameter R to the given [destination].
*/ */
public inline fun <reified R, C : MutableCollection<in R>> Stream<*>.filterIsInstanceTo(destination: C): C { public inline fun <reified R, C : MutableCollection<in R>> Stream<*>.filterIsInstanceTo(destination: C): C {
for (element in this) if (element is R) destination.add(element) for (element in this) if (element is R) destination.add(element)
@@ -549,7 +549,7 @@ public inline fun <reified R, C : MutableCollection<in R>> Stream<*>.filterIsIns
} }
/** /**
* Appends all elements that are instances of specified class to the given *destination* * Appends all elements that are instances of specified class to the given [destination].
*/ */
public fun <C : MutableCollection<in R>, R> Array<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C { public fun <C : MutableCollection<in R>, R> Array<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) destination.add(element as R) for (element in this) if (klass.isInstance(element)) destination.add(element as R)
@@ -557,7 +557,7 @@ public fun <C : MutableCollection<in R>, R> Array<*>.filterIsInstanceTo(destinat
} }
/** /**
* Appends all elements that are instances of specified class to the given *destination* * Appends all elements that are instances of specified class to the given [destination].
*/ */
public fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C { public fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) destination.add(element as R) for (element in this) if (klass.isInstance(element)) destination.add(element as R)
@@ -565,7 +565,7 @@ public fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(desti
} }
/** /**
* Appends all elements that are instances of specified class to the given *destination* * Appends all elements that are instances of specified class to the given [destination].
*/ */
public fun <C : MutableCollection<in R>, R> Sequence<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C { public fun <C : MutableCollection<in R>, R> Sequence<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) destination.add(element as R) for (element in this) if (klass.isInstance(element)) destination.add(element as R)
@@ -575,7 +575,7 @@ public fun <C : MutableCollection<in R>, R> Sequence<*>.filterIsInstanceTo(desti
deprecated("Migrate to using Sequence<T> and respective functions") deprecated("Migrate to using Sequence<T> and respective functions")
/** /**
* Appends all elements that are instances of specified class to the given *destination* * Appends all elements that are instances of specified class to the given [destination].
*/ */
public fun <C : MutableCollection<in R>, R> Stream<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C { public fun <C : MutableCollection<in R>, R> Stream<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C {
for (element in this) if (klass.isInstance(element)) destination.add(element as R) for (element in this) if (klass.isInstance(element)) destination.add(element as R)
@@ -583,56 +583,56 @@ public fun <C : MutableCollection<in R>, R> Stream<*>.filterIsInstanceTo(destina
} }
/** /**
* Sorts array or range in array inplace * Sorts array or range in array inplace.
*/ */
public fun <T> Array<out T>.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { public fun <T> Array<out T>.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit {
Arrays.sort(this, fromIndex, toIndex) Arrays.sort(this, fromIndex, toIndex)
} }
/** /**
* Sorts array or range in array inplace * Sorts array or range in array inplace.
*/ */
public fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { public fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit {
Arrays.sort(this, fromIndex, toIndex) Arrays.sort(this, fromIndex, toIndex)
} }
/** /**
* Sorts array or range in array inplace * Sorts array or range in array inplace.
*/ */
public fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { public fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit {
Arrays.sort(this, fromIndex, toIndex) Arrays.sort(this, fromIndex, toIndex)
} }
/** /**
* Sorts array or range in array inplace * Sorts array or range in array inplace.
*/ */
public fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { public fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit {
Arrays.sort(this, fromIndex, toIndex) Arrays.sort(this, fromIndex, toIndex)
} }
/** /**
* Sorts array or range in array inplace * Sorts array or range in array inplace.
*/ */
public fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { public fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit {
Arrays.sort(this, fromIndex, toIndex) Arrays.sort(this, fromIndex, toIndex)
} }
/** /**
* Sorts array or range in array inplace * Sorts array or range in array inplace.
*/ */
public fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { public fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit {
Arrays.sort(this, fromIndex, toIndex) Arrays.sort(this, fromIndex, toIndex)
} }
/** /**
* Sorts array or range in array inplace * Sorts array or range in array inplace.
*/ */
public fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { public fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit {
Arrays.sort(this, fromIndex, toIndex) Arrays.sort(this, fromIndex, toIndex)
} }
/** /**
* Sorts array or range in array inplace * Sorts array or range in array inplace.
*/ */
public fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit { public fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size()): Unit {
Arrays.sort(this, fromIndex, toIndex) Arrays.sort(this, fromIndex, toIndex)
@@ -7,7 +7,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("all(predicate: (T) -> Boolean)") { templates add f("all(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns *true* if all elements match the given *predicate*" } doc { "Returns `true` if all elements match the given [predicate]." }
returns("Boolean") returns("Boolean")
body { body {
""" """
@@ -21,7 +21,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("none(predicate: (T) -> Boolean)") { templates add f("none(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns *true* if no elements match the given *predicate*" } doc { "Returns `true` if no elements match the given [predicate]." }
returns("Boolean") returns("Boolean")
body { body {
""" """
@@ -33,7 +33,7 @@ fun aggregates(): List<GenericFunction> {
} }
templates add f("none()") { templates add f("none()") {
doc { "Returns *true* if collection has no elements" } doc { "Returns `true` if collection has no elements." }
returns("Boolean") returns("Boolean")
body { body {
""" """
@@ -47,7 +47,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("any(predicate: (T) -> Boolean)") { templates add f("any(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns *true* if any element matches the given [predicate]" } doc { "Returns `true` if at least one element matches the given [predicate]." }
returns("Boolean") returns("Boolean")
body { body {
""" """
@@ -59,7 +59,7 @@ fun aggregates(): List<GenericFunction> {
} }
templates add f("any()") { templates add f("any()") {
doc { "Returns *true* if collection has at least one element" } doc { "Returns `true` if collection has at least one element." }
returns("Boolean") returns("Boolean")
body { body {
""" """
@@ -73,7 +73,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("count(predicate: (T) -> Boolean)") { templates add f("count(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns the number of elements matching the given [predicate]" } doc { "Returns the number of elements matching the given [predicate]." }
returns("Int") returns("Int")
body { body {
""" """
@@ -86,7 +86,7 @@ fun aggregates(): List<GenericFunction> {
} }
templates add f("count()") { templates add f("count()") {
doc { "Returns the number of elements" } doc { "Returns the number of elements in this collection." }
returns("Int") returns("Int")
body { body {
""" """
@@ -95,6 +95,7 @@ fun aggregates(): List<GenericFunction> {
return count return count
""" """
} }
doc(Strings) { "Returns the length of this string."}
body(Strings) { body(Strings) {
"return length()" "return length()"
} }
@@ -105,8 +106,8 @@ fun aggregates(): List<GenericFunction> {
templates add f("sumBy(transform: (T) -> Int)") { templates add f("sumBy(transform: (T) -> Int)") {
inline(true) inline(true)
doc { "Returns the sum of all values produced by [transform] function from elements in the collection" } doc { "Returns the sum of all values produced by [transform] function from elements in the collection." }
doc(Strings) { "Returns the sum of all values produced by [transform] function from characters in the string" } doc(Strings) { "Returns the sum of all values produced by [transform] function from characters in the string." }
returns("Int") returns("Int")
body { body {
""" """
@@ -121,8 +122,8 @@ fun aggregates(): List<GenericFunction> {
templates add f("sumByDouble(transform: (T) -> Double)") { templates add f("sumByDouble(transform: (T) -> Double)") {
inline(true) inline(true)
doc { "Returns the sum of all values produced by [transform] function from elements in the collection" } doc { "Returns the sum of all values produced by [transform] function from elements in the collection." }
doc(Strings) { "Returns the sum of all values produced by [transform] function from characters in the string" } doc(Strings) { "Returns the sum of all values produced by [transform] function from characters in the string." }
returns("Double") returns("Double")
body { body {
""" """
@@ -136,7 +137,7 @@ fun aggregates(): List<GenericFunction> {
} }
templates add f("min()") { templates add f("min()") {
doc { "Returns the smallest element or null if there are no elements" } doc { "Returns the smallest element or `null` if there are no elements." }
returns("T?") returns("T?")
exclude(PrimitiveType.Boolean) exclude(PrimitiveType.Boolean)
typeParam("T : Comparable<T>") typeParam("T : Comparable<T>")
@@ -169,7 +170,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("minBy(f: (T) -> R)") { templates add f("minBy(f: (T) -> R)") {
inline(true) inline(true)
doc { "Returns the first element yielding the smallest value of the given function or null if there are no elements" } doc { "Returns the first element yielding the smallest value of the given function or `null` if there are no elements." }
typeParam("R : Comparable<R>") typeParam("R : Comparable<R>")
typeParam("T : Any") typeParam("T : Any")
returns("T?") returns("T?")
@@ -214,7 +215,7 @@ fun aggregates(): List<GenericFunction> {
inline(true) inline(true)
only(Maps) only(Maps)
doc { "Returns the first element yielding the smallest value of the given function or null if there are no elements" } doc { "Returns the first element yielding the smallest value of the given function or `null` if there are no elements." }
typeParam("R : Comparable<R>") typeParam("R : Comparable<R>")
returns("T?") returns("T?")
body { body {
@@ -238,7 +239,7 @@ fun aggregates(): List<GenericFunction> {
} }
templates add f("max()") { templates add f("max()") {
doc { "Returns the largest element or null if there are no elements" } doc { "Returns the largest element or `null` if there are no elements." }
returns("T?") returns("T?")
exclude(PrimitiveType.Boolean) exclude(PrimitiveType.Boolean)
typeParam("T : Comparable<T>") typeParam("T : Comparable<T>")
@@ -273,7 +274,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("maxBy(f: (T) -> R)") { templates add f("maxBy(f: (T) -> R)") {
inline(true) inline(true)
doc { "Returns the first element yielding the largest value of the given function or null if there are no elements" } doc { "Returns the first element yielding the largest value of the given function or `null` if there are no elements." }
typeParam("R : Comparable<R>") typeParam("R : Comparable<R>")
typeParam("T : Any") typeParam("T : Any")
returns("T?") returns("T?")
@@ -318,7 +319,7 @@ fun aggregates(): List<GenericFunction> {
inline(true) inline(true)
only(Maps) only(Maps)
doc { "Returns the first element yielding the largest value of the given function or null if there are no elements" } doc { "Returns the first element yielding the largest value of the given function or `null` if there are no elements." }
typeParam("R : Comparable<R>") typeParam("R : Comparable<R>")
returns("T?") returns("T?")
body { body {
@@ -344,7 +345,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("fold(initial: R, operation: (R, T) -> R)") { templates add f("fold(initial: R, operation: (R, T) -> R)") {
inline(true) inline(true)
doc { "Accumulates value starting with *initial* value and applying *operation* from left to right to current accumulator value and each element" } doc { "Accumulates value starting with [initial] value and applying [operation] from left to right to current accumulator value and each element." }
typeParam("R") typeParam("R")
returns("R") returns("R")
body { body {
@@ -360,7 +361,7 @@ fun aggregates(): List<GenericFunction> {
inline(true) inline(true)
only(Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) only(Strings, Lists, ArraysOfObjects, ArraysOfPrimitives)
doc { "Accumulates value starting with *initial* value and applying *operation* from right to left to each element and current accumulator value" } doc { "Accumulates value starting with [initial] value and applying [operation] from right to left to each element and current accumulator value." }
typeParam("R") typeParam("R")
returns("R") returns("R")
body { body {
@@ -380,12 +381,12 @@ fun aggregates(): List<GenericFunction> {
inline(true) inline(true)
exclude(ArraysOfObjects, Iterables, Sequences) exclude(ArraysOfObjects, Iterables, Sequences)
doc { "Accumulates value starting with the first element and applying *operation* from left to right to current accumulator value and each element" } doc { "Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element." }
returns("T") returns("T")
body { body {
""" """
val iterator = this.iterator() val iterator = this.iterator()
if (!iterator.hasNext()) throw UnsupportedOperationException("Empty iterable can't be reduced") if (!iterator.hasNext()) throw UnsupportedOperationException("Empty iterable can't be reduced.")
var accumulator = iterator.next() var accumulator = iterator.next()
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -400,14 +401,14 @@ fun aggregates(): List<GenericFunction> {
inline(true) inline(true)
only(ArraysOfObjects, Iterables, Sequences) only(ArraysOfObjects, Iterables, Sequences)
doc { "Accumulates value starting with the first element and applying *operation* from left to right to current accumulator value and each element" } doc { "Accumulates value starting with the first element and applying [operation] from left to right to current accumulator value and each element." }
typeParam("S") typeParam("S")
typeParam("T: S") typeParam("T: S")
returns("S") returns("S")
body { body {
""" """
val iterator = this.iterator() val iterator = this.iterator()
if (!iterator.hasNext()) throw UnsupportedOperationException("Empty iterable can't be reduced") if (!iterator.hasNext()) throw UnsupportedOperationException("Empty iterable can't be reduced.")
var accumulator: S = iterator.next() var accumulator: S = iterator.next()
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -422,12 +423,12 @@ fun aggregates(): List<GenericFunction> {
inline(true) inline(true)
only(Strings, ArraysOfPrimitives) only(Strings, ArraysOfPrimitives)
doc { "Accumulates value starting with last element and applying *operation* from right to left to each element and current accumulator value" } doc { "Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value." }
returns("T") returns("T")
body { body {
""" """
var index = lastIndex var index = lastIndex
if (index < 0) throw UnsupportedOperationException("Empty iterable can't be reduced") if (index < 0) throw UnsupportedOperationException("Empty iterable can't be reduced.")
var accumulator = get(index--) var accumulator = get(index--)
while (index >= 0) { while (index >= 0) {
@@ -443,14 +444,14 @@ fun aggregates(): List<GenericFunction> {
inline(true) inline(true)
only(Lists, ArraysOfObjects) only(Lists, ArraysOfObjects)
doc { "Accumulates value starting with last element and applying *operation* from right to left to each element and current accumulator value" } doc { "Accumulates value starting with last element and applying [operation] from right to left to each element and current accumulator value." }
typeParam("S") typeParam("S")
typeParam("T: S") typeParam("T: S")
returns("S") returns("S")
body { body {
""" """
var index = lastIndex var index = lastIndex
if (index < 0) throw UnsupportedOperationException("Empty iterable can't be reduced") if (index < 0) throw UnsupportedOperationException("Empty iterable can't be reduced.")
var accumulator: S = get(index--) var accumulator: S = get(index--)
while (index >= 0) { while (index >= 0) {
@@ -465,7 +466,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("forEach(operation: (T) -> Unit)") { templates add f("forEach(operation: (T) -> Unit)") {
inline(true) inline(true)
doc { "Performs the given *operation* on each element" } doc { "Performs the given [operation] on each element." }
returns("Unit") returns("Unit")
body { body {
""" """
@@ -477,7 +478,7 @@ fun aggregates(): List<GenericFunction> {
templates add f("forEachIndexed(operation: (Int, T) -> Unit)") { templates add f("forEachIndexed(operation: (Int, T) -> Unit)") {
inline(true) inline(true)
doc { "Performs the given *operation* on each element, providing sequential index with the element" } doc { "Performs the given [operation] on each element, providing sequential index with the element." }
returns("Unit") returns("Unit")
body { body {
""" """
@@ -7,7 +7,7 @@ fun arrays(): List<GenericFunction> {
templates add f("isEmpty()") { templates add f("isEmpty()") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns true if the array is empty" } doc { "Returns `true` if the array is empty." }
returns("Boolean") returns("Boolean")
body { body {
"return size() == 0" "return size() == 0"
@@ -16,7 +16,7 @@ fun arrays(): List<GenericFunction> {
templates add f("isNotEmpty()") { templates add f("isNotEmpty()") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns true if the array is not empty" } doc { "Returns `true` if the array is not empty." }
returns("Boolean") returns("Boolean")
body { body {
"return !isEmpty()" "return !isEmpty()"
@@ -25,7 +25,7 @@ fun arrays(): List<GenericFunction> {
templates add f("asIterable()") { templates add f("asIterable()") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns the Iterable that wraps the original array" } doc { "Returns the Iterable that wraps the original array." }
returns("Iterable<T>") returns("Iterable<T>")
body { body {
""" """
@@ -38,7 +38,7 @@ fun arrays(): List<GenericFunction> {
templates add pval("lastIndex") { templates add pval("lastIndex") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns the last valid index for the array" } doc { "Returns the last valid index for the array." }
returns("Int") returns("Int")
body { body {
"get() = size() - 1" "get() = size() - 1"
@@ -47,7 +47,7 @@ fun arrays(): List<GenericFunction> {
templates add pval("indices") { templates add pval("indices") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns the range of valid indices for the array" } doc { "Returns the range of valid indices for the array." }
returns("IntRange") returns("IntRange")
body { body {
"get() = IntRange(0, lastIndex)" "get() = IntRange(0, lastIndex)"
@@ -6,7 +6,7 @@ fun elements(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>() val templates = arrayListOf<GenericFunction>()
templates add f("contains(element: T)") { templates add f("contains(element: T)") {
doc { "Returns true if *element* is found in the collection" } doc { "Returns `true` if [element] is found in the collection." }
returns("Boolean") returns("Boolean")
body { body {
""" """
@@ -25,7 +25,7 @@ fun elements(): List<GenericFunction> {
templates add f("indexOf(element: T)") { templates add f("indexOf(element: T)") {
exclude(Strings, Lists) // has native implementation exclude(Strings, Lists) // has native implementation
doc { "Returns first index of [element], or -1 if the collection does not contain element" } doc { "Returns first index of [element], or -1 if the collection does not contain element." }
returns("Int") returns("Int")
body { body {
""" """
@@ -71,7 +71,7 @@ fun elements(): List<GenericFunction> {
templates add f("lastIndexOf(element: T)") { templates add f("lastIndexOf(element: T)") {
exclude(Strings, Lists) // has native implementation exclude(Strings, Lists) // has native implementation
doc { "Returns last index of *element*, or -1 if the collection does not contain element" } doc { "Returns last index of [element], or -1 if the collection does not contain element." }
returns("Int") returns("Int")
body { body {
""" """
@@ -119,7 +119,7 @@ fun elements(): List<GenericFunction> {
templates add f("indexOfFirst(predicate: (T) -> Boolean)") { templates add f("indexOfFirst(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element" } doc { "Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element." }
returns("Int") returns("Int")
body { body {
""" """
@@ -148,7 +148,7 @@ fun elements(): List<GenericFunction> {
templates add f("indexOfLast(predicate: (T) -> Boolean)") { templates add f("indexOfLast(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element" } doc { "Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element." }
returns("Int") returns("Int")
body { body {
""" """
@@ -184,12 +184,12 @@ fun elements(): List<GenericFunction> {
if (this is List<T>) if (this is List<T>)
return get(index) return get(index)
return elementAtOrElse(index) { throw IndexOutOfBoundsException("Collection doesn't contain element at index $index") } return elementAtOrElse(index) { throw IndexOutOfBoundsException("Collection doesn't contain element at index $index.") }
""" """
} }
body(Sequences) { body(Sequences) {
""" """
return elementAtOrElse(index) { throw IndexOutOfBoundsException("Sequence doesn't contain element at index $index") } return elementAtOrElse(index) { throw IndexOutOfBoundsException("Sequence doesn't contain element at index $index.") }
""" """
} }
body(Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) { body(Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) {
@@ -283,10 +283,10 @@ fun elements(): List<GenericFunction> {
templates add f("first()") { templates add f("first()") {
doc { """Returns first element. doc { """Returns first element.
@throws NoSuchElementException if the collection is empty. @throws [NoSuchElementException] if the collection is empty.
""" } """ }
doc(Strings) { """Returns first character. doc(Strings) { """Returns first character.
@throws NoSuchElementException if the string is empty. @throws [NoSuchElementException] if the string is empty.
""" } """ }
returns("T") returns("T")
body { body {
@@ -294,14 +294,14 @@ fun elements(): List<GenericFunction> {
when (this) { when (this) {
is List<*> -> { is List<*> -> {
if (isEmpty()) if (isEmpty())
throw NoSuchElementException("Collection is empty") throw NoSuchElementException("Collection is empty.")
else else
return this[0] as T return this[0] as T
} }
else -> { else -> {
val iterator = iterator() val iterator = iterator()
if (!iterator.hasNext()) if (!iterator.hasNext())
throw NoSuchElementException("Collection is empty") throw NoSuchElementException("Collection is empty.")
return iterator.next() return iterator.next()
} }
} }
@@ -310,14 +310,14 @@ fun elements(): List<GenericFunction> {
body(Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) { body(Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) {
""" """
if (isEmpty()) if (isEmpty())
throw NoSuchElementException("Collection is empty") throw NoSuchElementException("Collection is empty.")
return this[0] return this[0]
""" """
} }
} }
templates add f("firstOrNull()") { templates add f("firstOrNull()") {
doc { "Returns the first element, or null if the collection is empty." } doc { "Returns the first element, or `null` if the collection is empty." }
doc(Strings) { "Returns the first character, or null if string is empty." } doc(Strings) { "Returns the first character, or `null` if string is empty." }
returns("T?") returns("T?")
body { body {
""" """
@@ -348,14 +348,14 @@ fun elements(): List<GenericFunction> {
inline(true) inline(true)
doc { """Returns the first element matching the given [predicate]. doc { """Returns the first element matching the given [predicate].
@throws NoSuchElementException if no such element is found.""" } @throws [NoSuchElementException] if no such element is found.""" }
doc(Strings) { """Returns the first character matching the given [predicate]. doc(Strings) { """Returns the first character matching the given [predicate].
@throws NoSuchElementException if no such character is found.""" } @throws [NoSuchElementException] if no such character is found.""" }
returns("T") returns("T")
body { body {
""" """
for (element in this) if (predicate(element)) return element for (element in this) if (predicate(element)) return element
throw NoSuchElementException("No element matching predicate was found") throw NoSuchElementException("No element matching predicate was found.")
""" """
} }
} }
@@ -363,8 +363,8 @@ fun elements(): List<GenericFunction> {
templates add f("firstOrNull(predicate: (T) -> Boolean)") { templates add f("firstOrNull(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns the first element matching the given [predicate], or `null` if element was not found" } doc { "Returns the first element matching the given [predicate], or `null` if element was not found." }
doc(Strings) { "Returns the first character matching the given [predicate], or `null` if character was not found" } doc(Strings) { "Returns the first character matching the given [predicate], or `null` if character was not found." }
returns("T?") returns("T?")
body { body {
""" """
@@ -376,23 +376,23 @@ fun elements(): List<GenericFunction> {
templates add f("last()") { templates add f("last()") {
doc { """Returns the last element. doc { """Returns the last element.
@throws NoSuchElementException if the collection is empty.""" } @throws [NoSuchElementException] if the collection is empty.""" }
doc(Strings) { """"Returns the last character. doc(Strings) { """"Returns the last character.
@throws NoSuchElementException if the string is empty.""" } @throws [NoSuchElementException] if the string is empty.""" }
returns("T") returns("T")
body { body {
""" """
when (this) { when (this) {
is List<*> -> { is List<*> -> {
if (isEmpty()) if (isEmpty())
throw NoSuchElementException("Collection is empty") throw NoSuchElementException("Collection is empty.")
else else
return this[this.lastIndex] as T return this[this.lastIndex] as T
} }
else -> { else -> {
val iterator = iterator() val iterator = iterator()
if (!iterator.hasNext()) if (!iterator.hasNext())
throw NoSuchElementException("Collection is empty") throw NoSuchElementException("Collection is empty.")
var last = iterator.next() var last = iterator.next()
while (iterator.hasNext()) while (iterator.hasNext())
last = iterator.next() last = iterator.next()
@@ -405,7 +405,7 @@ fun elements(): List<GenericFunction> {
""" """
val iterator = iterator() val iterator = iterator()
if (!iterator.hasNext()) if (!iterator.hasNext())
throw NoSuchElementException("Collection is empty") throw NoSuchElementException("Collection is empty.")
var last = iterator.next() var last = iterator.next()
while (iterator.hasNext()) while (iterator.hasNext())
last = iterator.next() last = iterator.next()
@@ -415,15 +415,15 @@ fun elements(): List<GenericFunction> {
body(Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) { body(Strings, Lists, ArraysOfObjects, ArraysOfPrimitives) {
""" """
if (isEmpty()) if (isEmpty())
throw NoSuchElementException("Collection is empty") throw NoSuchElementException("Collection is empty.")
return this[lastIndex] return this[lastIndex]
""" """
} }
} }
templates add f("lastOrNull()") { templates add f("lastOrNull()") {
doc { "Returns the last element, or `null` if the collection is empty" } doc { "Returns the last element, or `null` if the collection is empty." }
doc(Strings) { "Returns the last character, or `null` if the string is empty" } doc(Strings) { "Returns the last character, or `null` if the string is empty." }
returns("T?") returns("T?")
body { body {
""" """
@@ -467,9 +467,9 @@ fun elements(): List<GenericFunction> {
templates add f("last(predicate: (T) -> Boolean)") { templates add f("last(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { """Returns the last element matching the given [predicate]. doc { """Returns the last element matching the given [predicate].
@throws NoSuchElementException if no such element is found.""" } @throws [NoSuchElementException] if no such element is found.""" }
doc(Strings) { """"Returns the last character matching the given [predicate]. doc(Strings) { """"Returns the last character matching the given [predicate].
@throws NoSuchElementException if no such character is found.""" } @throws [NoSuchElementException] if no such character is found.""" }
returns("T") returns("T")
body { body {
""" """
@@ -568,17 +568,17 @@ fun elements(): List<GenericFunction> {
""" """
when (this) { when (this) {
is List<*> -> return when (size()) { is List<*> -> return when (size()) {
0 -> throw NoSuchElementException("Collection is empty") 0 -> throw NoSuchElementException("Collection is empty.")
1 -> this[0] as T 1 -> this[0] as T
else -> throw IllegalArgumentException("Collection has more than one element") else -> throw IllegalArgumentException("Collection has more than one element.")
} }
else -> { else -> {
val iterator = iterator() val iterator = iterator()
if (!iterator.hasNext()) if (!iterator.hasNext())
throw NoSuchElementException("Collection is empty") throw NoSuchElementException("Collection is empty.")
var single = iterator.next() var single = iterator.next()
if (iterator.hasNext()) if (iterator.hasNext())
throw IllegalArgumentException("Collection has more than one element") throw IllegalArgumentException("Collection has more than one element.")
return single return single
} }
} }
@@ -587,18 +587,18 @@ fun elements(): List<GenericFunction> {
body(Strings) { body(Strings) {
""" """
return when (length()) { return when (length()) {
0 -> throw NoSuchElementException("Collection is empty") 0 -> throw NoSuchElementException("Collection is empty.")
1 -> this[0] 1 -> this[0]
else -> throw IllegalArgumentException("Collection has more than one element") else -> throw IllegalArgumentException("Collection has more than one element.")
} }
""" """
} }
body(Lists, ArraysOfObjects, ArraysOfPrimitives) { body(Lists, ArraysOfObjects, ArraysOfPrimitives) {
""" """
return when (size()) { return when (size()) {
0 -> throw NoSuchElementException("Collection is empty") 0 -> throw NoSuchElementException("Collection is empty.")
1 -> this[0] 1 -> this[0]
else -> throw IllegalArgumentException("Collection has more than one element") else -> throw IllegalArgumentException("Collection has more than one element.")
} }
""" """
} }
@@ -638,8 +638,8 @@ fun elements(): List<GenericFunction> {
templates add f("single(predicate: (T) -> Boolean)") { templates add f("single(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element" } doc { "Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element." }
doc(Strings) { "Returns the single character matching the given [predicate], or throws exception if there is no or more than one matching character" } doc(Strings) { "Returns the single character matching the given [predicate], or throws exception if there is no or more than one matching character." }
returns("T") returns("T")
body { body {
""" """
@@ -647,12 +647,12 @@ fun elements(): List<GenericFunction> {
var found = false var found = false
for (element in this) { for (element in this) {
if (predicate(element)) { if (predicate(element)) {
if (found) throw IllegalArgumentException("Collection contains more than one matching element") if (found) throw IllegalArgumentException("Collection contains more than one matching element.")
single = element single = element
found = true found = true
} }
} }
if (!found) throw NoSuchElementException("Collection doesn't contain any element matching predicate") if (!found) throw NoSuchElementException("Collection doesn't contain any element matching predicate.")
return single as T return single as T
""" """
} }
@@ -660,8 +660,8 @@ fun elements(): List<GenericFunction> {
templates add f("singleOrNull(predicate: (T) -> Boolean)") { templates add f("singleOrNull(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found" } doc { "Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found." }
doc(Strings) { "Returns the single character matching the given [predicate], or `null` if character was not found or more than one character was found" } doc(Strings) { "Returns the single character matching the given [predicate], or `null` if character was not found or more than one character was found." }
returns("T?") returns("T?")
body { body {
""" """
@@ -7,7 +7,7 @@ fun filtering(): List<GenericFunction> {
templates add f("drop(n: Int)") { templates add f("drop(n: Int)") {
val n = "\$n" val n = "\$n"
doc { "Returns a list containing all elements except first [n] elements" } doc { "Returns a list containing all elements except first [n] elements." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -37,7 +37,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Sequences) { "Returns a sequence containing all elements except first [n] elements" } doc(Sequences) { "Returns a sequence containing all elements except first [n] elements." }
returns(Sequences) { "Sequence<T>" } returns(Sequences) { "Sequence<T>" }
body(Sequences) { body(Sequences) {
""" """
@@ -46,7 +46,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Returns a string with the first [n] characters removed"} doc(Strings) { "Returns a string with the first [n] characters removed."}
body(Strings) { "return substring(Math.min(n, length()))" } body(Strings) { "return substring(Math.min(n, length()))" }
returns(Strings) { "String" } returns(Strings) { "String" }
@@ -67,7 +67,7 @@ fun filtering(): List<GenericFunction> {
templates add f("take(n: Int)") { templates add f("take(n: Int)") {
val n = "\$n" val n = "\$n"
doc { "Returns a list containing first [n] elements" } doc { "Returns a list containing first [n] elements." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -83,7 +83,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Returns a string containing the first [n] characters from this string, or the entire string if this string is shorter"} doc(Strings) { "Returns a string containing the first [n] characters from this string, or the entire string if this string is shorter."}
body(Strings) { body(Strings) {
""" """
require(n >= 0, { "Requested element count $n is less than zero." }) require(n >= 0, { "Requested element count $n is less than zero." })
@@ -92,7 +92,7 @@ fun filtering(): List<GenericFunction> {
} }
returns(Strings) { "String" } returns(Strings) { "String" }
doc(Sequences) { "Returns a sequence containing first *n* elements" } doc(Sequences) { "Returns a sequence containing first [n] elements." }
returns(Sequences) { "Sequence<T>" } returns(Sequences) { "Sequence<T>" }
body(Sequences) { body(Sequences) {
""" """
@@ -119,11 +119,11 @@ fun filtering(): List<GenericFunction> {
templates add f("takeLast(n: Int)") { templates add f("takeLast(n: Int)") {
val n = "\$n" val n = "\$n"
doc { "Returns a list containing last [n] elements" } doc { "Returns a list containing last [n] elements." }
only(Lists, ArraysOfObjects, ArraysOfPrimitives, Strings) only(Lists, ArraysOfObjects, ArraysOfPrimitives, Strings)
returns("List<T>") returns("List<T>")
doc(Strings) { "Returns a string containing the last [n] characters from this string, or the entire string if this string is shorter"} doc(Strings) { "Returns a string containing the last [n] characters from this string, or the entire string if this string is shorter."}
body(Strings) { body(Strings) {
""" """
require(n >= 0, { "Requested element count $n is less than zero." }) require(n >= 0, { "Requested element count $n is less than zero." })
@@ -149,7 +149,7 @@ fun filtering(): List<GenericFunction> {
templates add f("dropWhile(predicate: (T) -> Boolean)") { templates add f("dropWhile(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns a list containing all elements except first elements that satisfy the given [predicate]" } doc { "Returns a list containing all elements except first elements that satisfy the given [predicate]." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -166,7 +166,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Returns a string containing all characters except first characters that satisfy the given [predicate]" } doc(Strings) { "Returns a string containing all characters except first characters that satisfy the given [predicate]." }
returns(Strings) { "String" } returns(Strings) { "String" }
body(Strings) { body(Strings) {
""" """
@@ -179,7 +179,7 @@ fun filtering(): List<GenericFunction> {
} }
inline(false, Sequences) inline(false, Sequences)
doc(Sequences) { "Returns a sequence containing all elements except first elements that satisfy the given [predicate]" } doc(Sequences) { "Returns a sequence containing all elements except first elements that satisfy the given [predicate]." }
returns(Sequences) { "Sequence<T>" } returns(Sequences) { "Sequence<T>" }
body(Sequences) { body(Sequences) {
""" """
@@ -192,7 +192,7 @@ fun filtering(): List<GenericFunction> {
templates add f("takeWhile(predicate: (T) -> Boolean)") { templates add f("takeWhile(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns a list containing first elements satisfying the given [predicate]" } doc { "Returns a list containing first elements satisfying the given [predicate]." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -206,7 +206,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Returns a string containing the first characters that satisfy the given [predicate]"} doc(Strings) { "Returns a string containing the first characters that satisfy the given [predicate]."}
returns(Strings) { "String" } returns(Strings) { "String" }
body(Strings) { body(Strings) {
""" """
@@ -219,7 +219,7 @@ fun filtering(): List<GenericFunction> {
} }
inline(false, Sequences) inline(false, Sequences)
doc(Sequences) { "Returns a sequence containing first elements satisfying the given [predicate]" } doc(Sequences) { "Returns a sequence containing first elements satisfying the given [predicate]." }
returns(Sequences) { "Sequence<T>" } returns(Sequences) { "Sequence<T>" }
body(Sequences) { body(Sequences) {
""" """
@@ -231,7 +231,7 @@ fun filtering(): List<GenericFunction> {
templates add f("filter(predicate: (T) -> Boolean)") { templates add f("filter(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns a list containing all elements matching the given [predicate]" } doc { "Returns a list containing all elements matching the given [predicate]." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -239,7 +239,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Returns a string containing only those characters from the original string that match the given [predicate]" } doc(Strings) { "Returns a string containing only those characters from the original string that match the given [predicate]." }
returns(Strings) { "String" } returns(Strings) { "String" }
body(Strings) { body(Strings) {
""" """
@@ -248,7 +248,7 @@ fun filtering(): List<GenericFunction> {
} }
inline(false, Sequences) inline(false, Sequences)
doc(Sequences) { "Returns a sequence containing all elements matching the given [predicate]" } doc(Sequences) { "Returns a sequence containing all elements matching the given [predicate]." }
returns(Sequences) { "Sequence<T>" } returns(Sequences) { "Sequence<T>" }
body(Sequences) { body(Sequences) {
""" """
@@ -260,7 +260,7 @@ fun filtering(): List<GenericFunction> {
templates add f("filterTo(destination: C, predicate: (T) -> Boolean)") { templates add f("filterTo(destination: C, predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Appends all elements matching the given [predicate] into the given [destination]" } doc { "Appends all elements matching the given [predicate] into the given [destination]." }
typeParam("C : TCollection") typeParam("C : TCollection")
returns("C") returns("C")
@@ -271,7 +271,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Appends all characters matching the given [predicate] to the given [destination]" } doc(Strings) { "Appends all characters matching the given [predicate] to the given [destination]." }
body(Strings) { body(Strings) {
""" """
for (index in 0..length - 1) { for (index in 0..length - 1) {
@@ -286,7 +286,7 @@ fun filtering(): List<GenericFunction> {
templates add f("filterNot(predicate: (T) -> Boolean)") { templates add f("filterNot(predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Returns a list containing all elements not matching the given [predicate]" } doc { "Returns a list containing all elements not matching the given [predicate]." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -294,7 +294,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Returns a string containing only those characters from the original string that do not match the given [predicate]" } doc(Strings) { "Returns a string containing only those characters from the original string that do not match the given [predicate]." }
returns(Strings) { "String" } returns(Strings) { "String" }
body(Strings) { body(Strings) {
""" """
@@ -303,7 +303,7 @@ fun filtering(): List<GenericFunction> {
} }
inline(false, Sequences) inline(false, Sequences)
doc(Sequences) { "Returns a sequence containing all elements not matching the given [predicate]" } doc(Sequences) { "Returns a sequence containing all elements not matching the given [predicate]." }
returns(Sequences) { "Sequence<T>" } returns(Sequences) { "Sequence<T>" }
body(Sequences) { body(Sequences) {
""" """
@@ -315,7 +315,7 @@ fun filtering(): List<GenericFunction> {
templates add f("filterNotTo(destination: C, predicate: (T) -> Boolean)") { templates add f("filterNotTo(destination: C, predicate: (T) -> Boolean)") {
inline(true) inline(true)
doc { "Appends all elements not matching the given [predicate] to the given [destination]" } doc { "Appends all elements not matching the given [predicate] to the given [destination]." }
typeParam("C : TCollection") typeParam("C : TCollection")
returns("C") returns("C")
@@ -326,7 +326,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Appends all characters not matching the given [predicate] to the given [destination]" } doc(Strings) { "Appends all characters not matching the given [predicate] to the given [destination]." }
body(Strings) { body(Strings) {
""" """
for (element in this) if (!predicate(element)) destination.append(element) for (element in this) if (!predicate(element)) destination.append(element)
@@ -337,7 +337,7 @@ fun filtering(): List<GenericFunction> {
templates add f("filterNotNull()") { templates add f("filterNotNull()") {
exclude(ArraysOfPrimitives, Strings) exclude(ArraysOfPrimitives, Strings)
doc { "Returns a list containing all elements that are not null" } doc { "Returns a list containing all elements that are not `null`." }
typeParam("T : Any") typeParam("T : Any")
returns("List<T>") returns("List<T>")
toNullableT = true toNullableT = true
@@ -347,7 +347,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Sequences) { "Returns a sequence containing all elements that are not null" } doc(Sequences) { "Returns a sequence containing all elements that are not `null`." }
returns(Sequences) { "Sequence<T>" } returns(Sequences) { "Sequence<T>" }
body(Sequences) { body(Sequences) {
""" """
@@ -358,7 +358,7 @@ fun filtering(): List<GenericFunction> {
templates add f("filterNotNullTo(destination: C)") { templates add f("filterNotNullTo(destination: C)") {
exclude(ArraysOfPrimitives, Strings) exclude(ArraysOfPrimitives, Strings)
doc { "Appends all elements that are not null to the given [destination]" } doc { "Appends all elements that are not `null` to the given [destination]." }
returns("C") returns("C")
typeParam("C : TCollection") typeParam("C : TCollection")
typeParam("T : Any") typeParam("T : Any")
@@ -373,7 +373,7 @@ fun filtering(): List<GenericFunction> {
templates add f("slice(indices: Iterable<Int>)") { templates add f("slice(indices: Iterable<Int>)") {
only(Strings, Lists, ArraysOfPrimitives, ArraysOfObjects) only(Strings, Lists, ArraysOfPrimitives, ArraysOfObjects)
doc { "Returns a list containing elements at specified positions" } doc { "Returns a list containing elements at specified [indices]." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -385,7 +385,7 @@ fun filtering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Returns a string containing characters at specified positions" } doc(Strings) { "Returns a string containing characters at specified [indices]." }
returns(Strings) { "String" } returns(Strings) { "String" }
body(Strings) { body(Strings) {
""" """
@@ -7,7 +7,7 @@ fun generators(): List<GenericFunction> {
templates add f("plus(element: T)") { templates add f("plus(element: T)") {
exclude(Strings) exclude(Strings)
doc { "Returns a list containing all elements of original collection and then the given element" } doc { "Returns a list containing all elements of original collection and then the given [element]." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -26,7 +26,7 @@ fun generators(): List<GenericFunction> {
""" """
} }
doc(Sequences) { "Returns a sequence containing all elements of original sequence and then the given element" } doc(Sequences) { "Returns a sequence containing all elements of original sequence and then the given [element]." }
returns(Sequences) { "Sequence<T>" } returns(Sequences) { "Sequence<T>" }
body(Sequences) { body(Sequences) {
""" """
@@ -37,7 +37,7 @@ fun generators(): List<GenericFunction> {
templates add f("plus(collection: Iterable<T>)") { templates add f("plus(collection: Iterable<T>)") {
exclude(Strings, Sequences) exclude(Strings, Sequences)
doc { "Returns a list containing all elements of original collection and then all elements of the given *collection*" } doc { "Returns a list containing all elements of original collection and then all elements of the given [collection]." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -60,7 +60,7 @@ fun generators(): List<GenericFunction> {
templates add f("plus(array: Array<out T>)") { templates add f("plus(array: Array<out T>)") {
exclude(Strings, Sequences) exclude(Strings, Sequences)
doc { "Returns a list containing all elements of original collection and then all elements of the given *collection*" } doc { "Returns a list containing all elements of original collection and then all elements of the given [collection]." }
returns("List<T>") returns("List<T>")
body { body {
""" """
@@ -82,7 +82,7 @@ fun generators(): List<GenericFunction> {
templates add f("plus(collection: Iterable<T>)") { templates add f("plus(collection: Iterable<T>)") {
only(Sequences) only(Sequences)
doc { "Returns a sequence containing all elements of original sequence and then all elements of the given [collection]" } doc { "Returns a sequence containing all elements of original sequence and then all elements of the given [collection]." }
returns("Sequence<T>") returns("Sequence<T>")
body { body {
""" """
@@ -93,7 +93,7 @@ fun generators(): List<GenericFunction> {
templates add f("plus(sequence: Sequence<T>)") { templates add f("plus(sequence: Sequence<T>)") {
only(Sequences) only(Sequences)
doc { "Returns a sequence containing all elements of original sequence and then all elements of the given [sequence]" } doc { "Returns a sequence containing all elements of original sequence and then all elements of the given [sequence]." }
returns("Sequence<T>") returns("Sequence<T>")
body { body {
""" """
@@ -108,8 +108,8 @@ fun generators(): List<GenericFunction> {
doc { doc {
""" """
Splits original collection into pair of collections, Splits original collection into pair of collections,
where *first* collection contains elements for which predicate yielded *true*, where *first* collection contains elements for which [predicate] yielded [true],
while *second* collection contains elements for which predicate yielded *false* while *second* collection contains elements for which [predicate] yielded [false].
""" """
} }
// TODO: Sequence variant // TODO: Sequence variant
@@ -150,7 +150,7 @@ fun generators(): List<GenericFunction> {
exclude(Sequences, Strings) exclude(Sequences, Strings)
doc { doc {
""" """
Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
""" """
} }
typeParam("R") typeParam("R")
@@ -185,7 +185,7 @@ fun generators(): List<GenericFunction> {
exclude(Sequences, Strings) exclude(Sequences, Strings)
doc { doc {
""" """
Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
""" """
} }
typeParam("R") typeParam("R")
@@ -222,7 +222,7 @@ fun generators(): List<GenericFunction> {
only(ArraysOfPrimitives) only(ArraysOfPrimitives)
doc { doc {
""" """
Returns a list of values built from elements of both collections with same indexes using provided *transform*. List has length of shortest collection. Returns a list of values built from elements of both collections with same indexes using provided [transform]. List has length of shortest collection.
""" """
} }
typeParam("V") typeParam("V")
@@ -246,7 +246,7 @@ fun generators(): List<GenericFunction> {
only(Sequences) only(Sequences)
doc { doc {
""" """
Returns a sequence of values built from elements of both collections with same indexes using provided *transform*. Resulting sequence has length of shortest input sequences. Returns a sequence of values built from elements of both collections with same indexes using provided [transform]. Resulting sequence has length of shortest input sequences.
""" """
} }
typeParam("R") typeParam("R")
@@ -11,7 +11,7 @@ fun guards(): List<GenericFunction> {
templates add f("requireNoNulls()") { templates add f("requireNoNulls()") {
include(Lists) include(Lists)
exclude(Strings, ArraysOfPrimitives) exclude(Strings, ArraysOfPrimitives)
doc { "Returns an original collection containing all the non-*null* elements, throwing an [[IllegalArgumentException]] if there are any null elements" } doc { "Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements." }
typeParam("T : Any") typeParam("T : Any")
toNullableT = true toNullableT = true
returns("SELF") returns("SELF")
@@ -19,7 +19,7 @@ fun guards(): List<GenericFunction> {
""" """
for (element in this) { for (element in this) {
if (element == null) { if (element == null) {
throw IllegalArgumentException("null element found in $THIS") throw IllegalArgumentException("null element found in $THIS.")
} }
} }
return this as SELF return this as SELF
@@ -27,7 +27,7 @@ fun guards(): List<GenericFunction> {
} }
body(Sequences) { body(Sequences) {
""" """
return map { it ?: throw IllegalArgumentException("null element found in $THIS") } return map { it ?: throw IllegalArgumentException("null element found in $THIS.") }
""" """
} }
} }
@@ -7,7 +7,7 @@ fun mapping(): List<GenericFunction> {
templates add f("withIndices()") { templates add f("withIndices()") {
deprecate { "Use withIndex() instead." } deprecate { "Use withIndex() instead." }
doc { "Returns a list containing pairs of each element of the original collection and their index" } doc { "Returns a list containing pairs of each element of the original collection and their index." }
returns("List<Pair<Int, T>>") returns("List<Pair<Int, T>>")
body { body {
""" """
@@ -17,7 +17,7 @@ fun mapping(): List<GenericFunction> {
} }
returns(Sequences) { "Sequence<Pair<Int, T>>" } returns(Sequences) { "Sequence<Pair<Int, T>>" }
doc(Sequences) { "Returns a sequence containing pairs of each element of the original collection and their index" } doc(Sequences) { "Returns a sequence containing pairs of each element of the original collection and their index." }
body(Sequences) { body(Sequences) {
""" """
var index = 0 var index = 0
@@ -27,7 +27,7 @@ fun mapping(): List<GenericFunction> {
} }
templates add f("withIndex()") { templates add f("withIndex()") {
doc { "Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection" } doc { "Returns a lazy [Iterable] of [IndexedValue] for each element of the original collection." }
returns("Iterable<IndexedValue<T>>") returns("Iterable<IndexedValue<T>>")
body { body {
""" """
@@ -36,7 +36,7 @@ fun mapping(): List<GenericFunction> {
} }
returns(Sequences) { "Sequence<IndexedValue<T>>" } returns(Sequences) { "Sequence<IndexedValue<T>>" }
doc(Sequences) { "Returns a sequence of [IndexedValue] for each element of the original sequence" } doc(Sequences) { "Returns a sequence of [IndexedValue] for each element of the original sequence." }
body(Sequences) { body(Sequences) {
""" """
return IndexingSequence(this) return IndexingSequence(this)
@@ -47,7 +47,7 @@ fun mapping(): List<GenericFunction> {
templates add f("mapIndexed(transform: (Int, T) -> R)") { templates add f("mapIndexed(transform: (Int, T) -> R)") {
inline(true) inline(true)
doc { "Returns a list containing the results of applying the given *transform* function to each element and its index of the original collection" } doc { "Returns a list containing the results of applying the given [transform] function to each element and its index of the original collection." }
typeParam("R") typeParam("R")
returns("List<R>") returns("List<R>")
body { body {
@@ -61,7 +61,7 @@ fun mapping(): List<GenericFunction> {
} }
inline(false, Sequences) inline(false, Sequences)
returns(Sequences) { "Sequence<R>" } returns(Sequences) { "Sequence<R>" }
doc(Sequences) { "Returns a sequence containing the results of applying the given *transform* function to each element and its index of the original sequence" } doc(Sequences) { "Returns a sequence containing the results of applying the given [transform] function to each element and its index of the original sequence." }
body(Sequences) { body(Sequences) {
"return TransformingIndexedSequence(this, transform)" "return TransformingIndexedSequence(this, transform)"
} }
@@ -70,7 +70,7 @@ fun mapping(): List<GenericFunction> {
templates add f("map(transform: (T) -> R)") { templates add f("map(transform: (T) -> R)") {
inline(true) inline(true)
doc { "Returns a list containing the results of applying the given *transform* function to each element of the original collection" } doc { "Returns a list containing the results of applying the given [transform] function to each element of the original collection." }
typeParam("R") typeParam("R")
returns("List<R>") returns("List<R>")
body { body {
@@ -85,7 +85,7 @@ fun mapping(): List<GenericFunction> {
inline(false, Sequences) inline(false, Sequences)
returns(Sequences) { "Sequence<R>" } returns(Sequences) { "Sequence<R>" }
doc(Sequences) { "Returns a sequence containing the results of applying the given *transform* function to each element of the original sequence" } doc(Sequences) { "Returns a sequence containing the results of applying the given [transform] function to each element of the original sequence." }
body(Sequences) { body(Sequences) {
"return TransformingSequence(this, transform)" "return TransformingSequence(this, transform)"
} }
@@ -95,7 +95,7 @@ fun mapping(): List<GenericFunction> {
templates add f("mapNotNull(transform: (T) -> R)") { templates add f("mapNotNull(transform: (T) -> R)") {
inline(true) inline(true)
exclude(Strings, ArraysOfPrimitives) exclude(Strings, ArraysOfPrimitives)
doc { "Returns a list containing the results of applying the given *transform* function to each non-null element of the original collection" } doc { "Returns a list containing the results of applying the given [transform] function to each non-null element of the original collection." }
typeParam("T : Any") typeParam("T : Any")
typeParam("R") typeParam("R")
returns("List<R>") returns("List<R>")
@@ -106,7 +106,7 @@ fun mapping(): List<GenericFunction> {
""" """
} }
doc(Sequences) { "Returns a sequence containing the results of applying the given *transform* function to each non-null element of the original sequence" } doc(Sequences) { "Returns a sequence containing the results of applying the given [transform] function to each non-null element of the original sequence." }
returns(Sequences) { "Sequence<R>" } returns(Sequences) { "Sequence<R>" }
inline(false, Sequences) inline(false, Sequences)
body(Sequences) { body(Sequences) {
@@ -121,8 +121,8 @@ fun mapping(): List<GenericFunction> {
doc { doc {
""" """
Appends transformed elements of the original collection using the given *transform* function Appends transformed elements of the original collection using the given [transform] function
to the given *destination* to the given [destination].
""" """
} }
typeParam("R") typeParam("R")
@@ -144,8 +144,8 @@ fun mapping(): List<GenericFunction> {
doc { doc {
""" """
Appends transformed elements and their indices of the original collection using the given *transform* function Appends transformed elements and their indices of the original collection using the given [transform] function
to the given *destination* to the given [destination].
""" """
} }
typeParam("R") typeParam("R")
@@ -168,8 +168,8 @@ fun mapping(): List<GenericFunction> {
exclude(Strings, ArraysOfPrimitives) exclude(Strings, ArraysOfPrimitives)
doc { doc {
""" """
Appends transformed non-null elements of original collection using the given *transform* function Appends transformed non-null elements of original collection using the given [transform] function
to the given *destination* to the given [destination].
""" """
} }
typeParam("T : Any") typeParam("T : Any")
@@ -193,7 +193,7 @@ fun mapping(): List<GenericFunction> {
inline(true) inline(true)
exclude(Sequences) exclude(Sequences)
doc { "Returns a single list of all elements yielded from results of *transform* function being invoked on each element of original collection" } doc { "Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection." }
typeParam("R") typeParam("R")
returns("List<R>") returns("List<R>")
body { body {
@@ -204,7 +204,7 @@ fun mapping(): List<GenericFunction> {
templates add f("flatMap(transform: (T) -> Sequence<R>)") { templates add f("flatMap(transform: (T) -> Sequence<R>)") {
only(Sequences) only(Sequences)
doc { "Returns a single sequence of all elements from results of *transform* function being invoked on each element of original sequence" } doc { "Returns a single sequence of all elements from results of [transform] function being invoked on each element of original sequence." }
typeParam("R") typeParam("R")
returns("Sequence<R>") returns("Sequence<R>")
body { body {
@@ -215,7 +215,7 @@ fun mapping(): List<GenericFunction> {
templates add f("flatMapTo(destination: C, transform: (T) -> Iterable<R>)") { templates add f("flatMapTo(destination: C, transform: (T) -> Iterable<R>)") {
inline(true) inline(true)
exclude(Sequences) exclude(Sequences)
doc { "Appends all elements yielded from results of *transform* function being invoked on each element of original collection, to the given *destination*" } doc { "Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination]." }
typeParam("R") typeParam("R")
typeParam("C : MutableCollection<in R>") typeParam("C : MutableCollection<in R>")
returns("C") returns("C")
@@ -235,7 +235,7 @@ fun mapping(): List<GenericFunction> {
inline(true) inline(true)
only(Sequences) only(Sequences)
doc { "Appends all elements yielded from results of *transform* function being invoked on each element of original sequence, to the given *destination*" } doc { "Appends all elements yielded from results of [transform] function being invoked on each element of original sequence, to the given [destination]." }
typeParam("R") typeParam("R")
typeParam("C : MutableCollection<in R>") typeParam("C : MutableCollection<in R>")
returns("C") returns("C")
@@ -253,7 +253,7 @@ fun mapping(): List<GenericFunction> {
templates add f("groupBy(toKey: (T) -> K)") { templates add f("groupBy(toKey: (T) -> K)") {
inline(true) inline(true)
doc { "Returns a map of the elements in original collection grouped by the result of given *toKey* function" } doc { "Returns a map of the elements in original collection grouped by the result of given [toKey] function." }
typeParam("K") typeParam("K")
returns("Map<K, List<T>>") returns("Map<K, List<T>>")
body { "return groupByTo(LinkedHashMap<K, MutableList<T>>(), toKey)" } body { "return groupByTo(LinkedHashMap<K, MutableList<T>>(), toKey)" }
@@ -263,7 +263,7 @@ fun mapping(): List<GenericFunction> {
inline(true) inline(true)
typeParam("K") typeParam("K")
doc { "Appends elements from original collection grouped by the result of given *toKey* function to the given *map*" } doc { "Appends elements from original collection grouped by the result of given [toKey] function to the given [map]." }
returns("Map<K, MutableList<T>>") returns("Map<K, MutableList<T>>")
body { body {
""" """
@@ -24,7 +24,7 @@ fun numeric(): List<GenericFunction> {
templates add f("average()") { templates add f("average()") {
exclude(Strings) exclude(Strings)
doc { "Returns an average value of elements in the collection"} doc { "Returns an average value of elements in the collection."}
returns("Double") returns("Double")
platformName("averageOf<T>") platformName("averageOf<T>")
body { body {
@@ -6,7 +6,7 @@ fun ordering(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>() val templates = arrayListOf<GenericFunction>()
templates add f("reverse()") { templates add f("reverse()") {
doc { "Returns a list with elements in reversed order" } doc { "Returns a list with elements in reversed order." }
returns { "List<T>" } returns { "List<T>" }
body { body {
""" """
@@ -16,7 +16,7 @@ fun ordering(): List<GenericFunction> {
""" """
} }
doc(Strings) { "Returns a string with characters in reversed order" } doc(Strings) { "Returns a string with characters in reversed order." }
returns(Strings) { "String" } returns(Strings) { "String" }
body(Strings) { body(Strings) {
// TODO: Replace with StringBuilder(this) when JS can handle it // TODO: Replace with StringBuilder(this) when JS can handle it
@@ -31,7 +31,7 @@ fun ordering(): List<GenericFunction> {
templates add f("sort()") { templates add f("sort()") {
doc { doc {
""" """
Returns a sorted list of all elements Returns a sorted list of all elements.
""" """
} }
returns("List<T>") returns("List<T>")
@@ -53,7 +53,7 @@ fun ordering(): List<GenericFunction> {
templates add f("toSortedList()") { templates add f("toSortedList()") {
doc { doc {
""" """
Returns a sorted list of all elements Returns a sorted list of all elements.
""" """
} }
returns("List<T>") returns("List<T>")
@@ -72,7 +72,7 @@ fun ordering(): List<GenericFunction> {
templates add f("sortDescending()") { templates add f("sortDescending()") {
doc { doc {
""" """
Returns a sorted list of all elements, in descending order Returns a sorted list of all elements, in descending order.
""" """
} }
returns("List<T>") returns("List<T>")
@@ -96,7 +96,7 @@ fun ordering(): List<GenericFunction> {
doc { doc {
""" """
Returns a sorted list of all elements, ordered by results of specified *order* function. Returns a sorted list of all elements, ordered by results of specified [order] function.
""" """
} }
returns("List<T>") returns("List<T>")
@@ -118,7 +118,7 @@ fun ordering(): List<GenericFunction> {
templates add f("toSortedListBy(order: (T) -> V)") { templates add f("toSortedListBy(order: (T) -> V)") {
doc { doc {
""" """
Returns a sorted list of all elements, ordered by results of specified *order* function. Returns a sorted list of all elements, ordered by results of specified [order] function.
""" """
} }
returns("List<T>") returns("List<T>")
@@ -141,7 +141,7 @@ fun ordering(): List<GenericFunction> {
doc { doc {
""" """
Returns a sorted list of all elements, in descending order by results of specified *order* function. Returns a sorted list of all elements, in descending order by results of specified [order] function.
""" """
} }
returns("List<T>") returns("List<T>")
@@ -163,7 +163,7 @@ fun ordering(): List<GenericFunction> {
templates add f("sortBy(comparator: Comparator<in T>)") { templates add f("sortBy(comparator: Comparator<in T>)") {
doc { doc {
""" """
Returns a list of all elements, sorted by the specified *comparator* Returns a list of all elements, sorted by the specified [comparator].
""" """
} }
returns("List<T>") returns("List<T>")
@@ -8,8 +8,8 @@ fun ranges(): List<GenericFunction> {
templates add f("reversed()") { templates add f("reversed()") {
only(RangesOfPrimitives, ProgressionsOfPrimitives) only(RangesOfPrimitives, ProgressionsOfPrimitives)
exclude(PrimitiveType.Boolean) exclude(PrimitiveType.Boolean)
doc(ProgressionsOfPrimitives) { "Returns a progression that goes over the same range in the opposite direction with the same step" } doc(ProgressionsOfPrimitives) { "Returns a progression that goes over the same range in the opposite direction with the same step." }
doc(RangesOfPrimitives) { "Returns a progression that goes over this range in reverse direction" } doc(RangesOfPrimitives) { "Returns a progression that goes over this range in reverse direction." }
returns("TProgression") returns("TProgression")
body(RangesOfPrimitives) { body(RangesOfPrimitives) {
"return TProgression(end, start, -ONE)" "return TProgression(end, start, -ONE)"
@@ -22,8 +22,8 @@ fun ranges(): List<GenericFunction> {
templates add f("step(step: SUM)") { templates add f("step(step: SUM)") {
only(RangesOfPrimitives, ProgressionsOfPrimitives) only(RangesOfPrimitives, ProgressionsOfPrimitives)
exclude(PrimitiveType.Boolean) exclude(PrimitiveType.Boolean)
doc(ProgressionsOfPrimitives) { "Returns a progression that goes over the same range with the given step" } doc(ProgressionsOfPrimitives) { "Returns a progression that goes over the same range with the given step." }
doc(RangesOfPrimitives) { "Returns a progression that goes over this range with given step" } doc(RangesOfPrimitives) { "Returns a progression that goes over this range with given step." }
returns("TProgression") returns("TProgression")
body(RangesOfPrimitives) { body(RangesOfPrimitives) {
""" """
@@ -33,7 +33,7 @@ fun ranges(): List<GenericFunction> {
} }
bodyForTypes(RangesOfPrimitives, PrimitiveType.Float, PrimitiveType.Double) { bodyForTypes(RangesOfPrimitives, PrimitiveType.Float, PrimitiveType.Double) {
""" """
if (step.isNaN()) throw IllegalArgumentException("Step must not be NaN") if (step.isNaN()) throw IllegalArgumentException("Step must not be NaN.")
checkStepIsPositive(step > 0, step) checkStepIsPositive(step > 0, step)
return TProgression(start, end, step) return TProgression(start, end, step)
""" """
@@ -45,7 +45,7 @@ fun sequences(): List<GenericFunction> {
templates add f("asSequence()") { templates add f("asSequence()") {
include(Maps) include(Maps)
exclude(Sequences) exclude(Sequences)
doc { "Returns a sequence from the given collection" } doc { "Returns a sequence from the given collection." }
returns("Sequence<T>") returns("Sequence<T>")
body { body {
""" """
@@ -7,7 +7,7 @@ fun snapshots(): List<GenericFunction> {
val templates = arrayListOf<GenericFunction>() val templates = arrayListOf<GenericFunction>()
templates add f("toCollection(collection: C)") { templates add f("toCollection(collection: C)") {
doc { "Appends all elements to the given *collection*" } doc { "Appends all elements to the given [collection]." }
returns("C") returns("C")
typeParam("C : MutableCollection<in T>") typeParam("C : MutableCollection<in T>")
body { body {
@@ -21,7 +21,7 @@ fun snapshots(): List<GenericFunction> {
} }
templates add f("toSet()") { templates add f("toSet()") {
doc { "Returns a Set of all elements" } doc { "Returns a [Set] of all elements." }
returns("Set<T>") returns("Set<T>")
body { "return toCollection(LinkedHashSet<T>(mapCapacity(collectionSizeOrDefault(12))))" } body { "return toCollection(LinkedHashSet<T>(mapCapacity(collectionSizeOrDefault(12))))" }
body(Sequences) { "return toCollection(LinkedHashSet<T>())" } body(Sequences) { "return toCollection(LinkedHashSet<T>())" }
@@ -30,7 +30,7 @@ fun snapshots(): List<GenericFunction> {
} }
templates add f("toHashSet()") { templates add f("toHashSet()") {
doc { "Returns a HashSet of all elements" } doc { "Returns a [HashSet] of all elements." }
returns("HashSet<T>") returns("HashSet<T>")
body { "return toCollection(HashSet<T>(mapCapacity(collectionSizeOrDefault(12))))" } body { "return toCollection(HashSet<T>(mapCapacity(collectionSizeOrDefault(12))))" }
body(Sequences) { "return toCollection(HashSet<T>())" } body(Sequences) { "return toCollection(HashSet<T>())" }
@@ -39,13 +39,13 @@ fun snapshots(): List<GenericFunction> {
} }
templates add f("toSortedSet()") { templates add f("toSortedSet()") {
doc { "Returns a SortedSet of all elements" } doc { "Returns a [SortedSet] of all elements." }
returns("SortedSet<T>") returns("SortedSet<T>")
body { "return toCollection(TreeSet<T>())" } body { "return toCollection(TreeSet<T>())" }
} }
templates add f("toArrayList()") { templates add f("toArrayList()") {
doc { "Returns an ArrayList of all elements" } doc { "Returns an [ArrayList] of all elements." }
returns("ArrayList<T>") returns("ArrayList<T>")
body { "return toCollection(ArrayList<T>())" } body { "return toCollection(ArrayList<T>())" }
body(Iterables) { body(Iterables) {
@@ -69,7 +69,7 @@ fun snapshots(): List<GenericFunction> {
templates add f("toList()") { templates add f("toList()") {
only(Maps) only(Maps)
doc { "Returns a List containing all key-value pairs" } doc { "Returns a [List] containing all key-value pairs." }
returns("List<Pair<K, V>>") returns("List<Pair<K, V>>")
body { body {
""" """
@@ -82,13 +82,13 @@ fun snapshots(): List<GenericFunction> {
} }
templates add f("toList()") { templates add f("toList()") {
doc { "Returns a List containing all elements" } doc { "Returns a [List] containing all elements." }
returns("List<T>") returns("List<T>")
body { "return this.toArrayList()" } body { "return this.toArrayList()" }
} }
templates add f("toLinkedList()") { templates add f("toLinkedList()") {
doc { "Returns a LinkedList containing all elements" } doc { "Returns a [LinkedList] containing all elements." }
returns("LinkedList<T>") returns("LinkedList<T>")
body { "return toCollection(LinkedList<T>())" } body { "return toCollection(LinkedList<T>())" }
} }
@@ -98,7 +98,7 @@ fun snapshots(): List<GenericFunction> {
typeParam("K") typeParam("K")
doc { doc {
""" """
Returns Map containing all the values from the given collection indexed by *selector* Returns Map containing all the values from the given collection indexed by [selector].
""" """
} }
returns("Map<K, T>") returns("Map<K, T>")
@@ -155,7 +155,7 @@ fun snapshots(): List<GenericFunction> {
typeParam("V") typeParam("V")
doc { doc {
""" """
Returns Map containing all the values provided by *transform* and indexed by *selector* from the given collection Returns Map containing all the values provided by [transform] and indexed by [selector] from the given collection.
""" """
} }
returns("Map<K, V>") returns("Map<K, V>")
@@ -7,7 +7,7 @@ fun specialJS(): List<GenericFunction> {
templates add f("asList()") { templates add f("asList()") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns a list that wraps the original array" } doc { "Returns a [List] that wraps the original array." }
returns("List<T>") returns("List<T>")
body(ArraysOfObjects) { body(ArraysOfObjects) {
""" """
@@ -7,7 +7,7 @@ fun specialJVM(): List<GenericFunction> {
templates add f("copyOfRange(from: Int, to: Int)") { templates add f("copyOfRange(from: Int, to: Int)") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns new array which is a copy of range of original array" } doc { "Returns new array which is a copy of range of original array." }
returns("SELF") returns("SELF")
returns(ArraysOfObjects) { "Array<T>" } returns(ArraysOfObjects) { "Array<T>" }
body { body {
@@ -17,7 +17,7 @@ fun specialJVM(): List<GenericFunction> {
templates add f("copyOf()") { templates add f("copyOf()") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns new array which is a copy of the original array" } doc { "Returns new array which is a copy of the original array." }
returns("SELF") returns("SELF")
returns(ArraysOfObjects) { "Array<T>" } returns(ArraysOfObjects) { "Array<T>" }
body { body {
@@ -31,7 +31,7 @@ fun specialJVM(): List<GenericFunction> {
// This overload can cause nulls if array size is expanding, hence different return overload // This overload can cause nulls if array size is expanding, hence different return overload
templates add f("copyOf(newSize: Int)") { templates add f("copyOf(newSize: Int)") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns new array which is a copy of the original array" } doc { "Returns new array which is a copy of the original array." }
returns("SELF") returns("SELF")
body { body {
"return Arrays.copyOf(this, newSize)" "return Arrays.copyOf(this, newSize)"
@@ -44,7 +44,7 @@ fun specialJVM(): List<GenericFunction> {
templates add f("fill(element: T)") { templates add f("fill(element: T)") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Fills original array with the provided value" } doc { "Fills original array with the provided value." }
returns { "SELF" } returns { "SELF" }
returns(ArraysOfObjects) { "Array<out T>" } returns(ArraysOfObjects) { "Array<out T>" }
body { body {
@@ -68,7 +68,7 @@ fun specialJVM(): List<GenericFunction> {
templates add f("sort(fromIndex: Int = 0, toIndex: Int = size())") { templates add f("sort(fromIndex: Int = 0, toIndex: Int = size())") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
exclude(PrimitiveType.Boolean) exclude(PrimitiveType.Boolean)
doc { "Sorts array or range in array inplace" } doc { "Sorts array or range in array inplace." }
returns("Unit") returns("Unit")
body { body {
"Arrays.sort(this, fromIndex, toIndex)" "Arrays.sort(this, fromIndex, toIndex)"
@@ -76,7 +76,7 @@ fun specialJVM(): List<GenericFunction> {
} }
templates add f("filterIsInstanceTo(destination: C, klass: Class<R>)") { templates add f("filterIsInstanceTo(destination: C, klass: Class<R>)") {
doc { "Appends all elements that are instances of specified class to the given *destination*" } doc { "Appends all elements that are instances of specified class to the given [destination]." }
receiverAsterisk(true) receiverAsterisk(true)
typeParam("C : MutableCollection<in R>") typeParam("C : MutableCollection<in R>")
typeParam("R") typeParam("R")
@@ -91,7 +91,7 @@ fun specialJVM(): List<GenericFunction> {
} }
templates add f("filterIsInstance(klass: Class<R>)") { templates add f("filterIsInstance(klass: Class<R>)") {
doc { "Returns a list containing all elements that are instances of specified class" } doc { "Returns a list containing all elements that are instances of specified class." }
receiverAsterisk(true) receiverAsterisk(true)
typeParam("R") typeParam("R")
returns("List<R>") returns("List<R>")
@@ -102,7 +102,7 @@ fun specialJVM(): List<GenericFunction> {
} }
exclude(ArraysOfPrimitives, Strings) exclude(ArraysOfPrimitives, Strings)
doc(Sequences) { "Returns a sequence containing all elements that are instances of specified class" } doc(Sequences) { "Returns a sequence containing all elements that are instances of specified class." }
returns(Sequences) { "Sequence<R>" } returns(Sequences) { "Sequence<R>" }
body(Sequences) { body(Sequences) {
""" """
@@ -112,7 +112,7 @@ fun specialJVM(): List<GenericFunction> {
} }
templates add f("filterIsInstanceTo(destination: C)") { templates add f("filterIsInstanceTo(destination: C)") {
doc { "Appends all elements that are instances of specified type parameter R to the given *destination*" } doc { "Appends all elements that are instances of specified type parameter R to the given [destination]." }
typeParam("reified R") typeParam("reified R")
typeParam("C : MutableCollection<in R>") typeParam("C : MutableCollection<in R>")
inline(true) inline(true)
@@ -128,7 +128,7 @@ fun specialJVM(): List<GenericFunction> {
} }
templates add f("filterIsInstance()") { templates add f("filterIsInstance()") {
doc { "Returns a list containing all elements that are instances of specified type parameter R" } doc { "Returns a list containing all elements that are instances of specified type parameter R." }
typeParam("reified R") typeParam("reified R")
returns("List<R>") returns("List<R>")
inline(true) inline(true)
@@ -140,7 +140,7 @@ fun specialJVM(): List<GenericFunction> {
} }
exclude(ArraysOfPrimitives, Strings) exclude(ArraysOfPrimitives, Strings)
doc(Sequences) { "Returns a sequence containing all elements that are instances of specified type parameter R" } doc(Sequences) { "Returns a sequence containing all elements that are instances of specified type parameter R." }
returns(Sequences) { "Sequence<R>" } returns(Sequences) { "Sequence<R>" }
inline(true) inline(true)
receiverAsterisk(true) receiverAsterisk(true)
@@ -153,7 +153,7 @@ fun specialJVM(): List<GenericFunction> {
templates add f("asList()") { templates add f("asList()") {
only(ArraysOfObjects, ArraysOfPrimitives) only(ArraysOfObjects, ArraysOfPrimitives)
doc { "Returns a list that wraps the original array" } doc { "Returns a [List] that wraps the original array." }
returns("List<T>") returns("List<T>")
body(ArraysOfObjects) { body(ArraysOfObjects) {
""" """