Some 200 warnings eliminated from stdlib code
This commit is contained in:
@@ -132,9 +132,7 @@ public inline fun <T, C: MutableCollection<in T>> Array<T?>?.filterNotNullTo(res
|
||||
public inline fun <T, R> Array<T>.flatMapTo(result: MutableCollection<R>, transform: (T) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <T,R> Array<T>.foldRight(initial: R, operation: (T, R) -> R):
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun <T> Array<T>.reduce(operation: (T, T) -> T): T {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <T, K> Array<T>.groupByTo(result: MutableMap<K, MutableList<T>
|
||||
public inline fun <T> Array<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -132,9 +132,7 @@ public inline fun <C: MutableCollection<Boolean>> BooleanArray?.filterNotNullTo(
|
||||
public inline fun <R> BooleanArray.flatMapTo(result: MutableCollection<R>, transform: (Boolean) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <R> BooleanArray.foldRight(initial: R, operation: (Boolean, R)
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun BooleanArray.reduce(operation: (Boolean, Boolean) -> Boolean): Boolean {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <K> BooleanArray.groupByTo(result: MutableMap<K, MutableList<B
|
||||
public inline fun BooleanArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -132,9 +132,7 @@ public inline fun <C: MutableCollection<Byte>> ByteArray?.filterNotNullTo(result
|
||||
public inline fun <R> ByteArray.flatMapTo(result: MutableCollection<R>, transform: (Byte) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <R> ByteArray.foldRight(initial: R, operation: (Byte, R) -> R)
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun ByteArray.reduce(operation: (Byte, Byte) -> Byte): Byte {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <K> ByteArray.groupByTo(result: MutableMap<K, MutableList<Byte
|
||||
public inline fun ByteArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -132,9 +132,7 @@ public inline fun <C: MutableCollection<Char>> CharArray?.filterNotNullTo(result
|
||||
public inline fun <R> CharArray.flatMapTo(result: MutableCollection<R>, transform: (Char) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <R> CharArray.foldRight(initial: R, operation: (Char, R) -> R)
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun CharArray.reduce(operation: (Char, Char) -> Char): Char {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <K> CharArray.groupByTo(result: MutableMap<K, MutableList<Char
|
||||
public inline fun CharArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -132,9 +132,7 @@ public inline fun <C: MutableCollection<Double>> DoubleArray?.filterNotNullTo(re
|
||||
public inline fun <R> DoubleArray.flatMapTo(result: MutableCollection<R>, transform: (Double) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <R> DoubleArray.foldRight(initial: R, operation: (Double, R) -
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun DoubleArray.reduce(operation: (Double, Double) -> Double): Double {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <K> DoubleArray.groupByTo(result: MutableMap<K, MutableList<Do
|
||||
public inline fun DoubleArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -132,9 +132,7 @@ public inline fun <C: MutableCollection<Float>> FloatArray?.filterNotNullTo(resu
|
||||
public inline fun <R> FloatArray.flatMapTo(result: MutableCollection<R>, transform: (Float) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <R> FloatArray.foldRight(initial: R, operation: (Float, R) ->
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun FloatArray.reduce(operation: (Float, Float) -> Float): Float {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <K> FloatArray.groupByTo(result: MutableMap<K, MutableList<Flo
|
||||
public inline fun FloatArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -132,9 +132,7 @@ public inline fun <C: MutableCollection<Int>> IntArray?.filterNotNullTo(result:
|
||||
public inline fun <R> IntArray.flatMapTo(result: MutableCollection<R>, transform: (Int) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <R> IntArray.foldRight(initial: R, operation: (Int, R) -> R):
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun IntArray.reduce(operation: (Int, Int) -> Int): Int {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <K> IntArray.groupByTo(result: MutableMap<K, MutableList<Int>>
|
||||
public inline fun IntArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -131,9 +131,7 @@ public inline fun <T, C: MutableCollection<in T>> Iterator<T?>?.filterNotNullTo(
|
||||
public inline fun <T, R> Iterator<T>.flatMapTo(result: MutableCollection<R>, transform: (T) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -171,7 +169,7 @@ public inline fun <T,R> Iterator<T>.foldRight(initial: R, operation: (T, R) -> R
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun <T> Iterator<T>.reduce(operation: (T, T) -> T): T {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -225,7 +223,7 @@ public inline fun <T, K> Iterator<T>.groupByTo(result: MutableMap<K, MutableList
|
||||
public inline fun <T> Iterator<T>.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -132,9 +132,7 @@ public inline fun <C: MutableCollection<Long>> LongArray?.filterNotNullTo(result
|
||||
public inline fun <R> LongArray.flatMapTo(result: MutableCollection<R>, transform: (Long) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <R> LongArray.foldRight(initial: R, operation: (Long, R) -> R)
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun LongArray.reduce(operation: (Long, Long) -> Long): Long {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <K> LongArray.groupByTo(result: MutableMap<K, MutableList<Long
|
||||
public inline fun LongArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
@@ -132,9 +132,7 @@ public inline fun <C: MutableCollection<Short>> ShortArray?.filterNotNullTo(resu
|
||||
public inline fun <R> ShortArray.flatMapTo(result: MutableCollection<R>, transform: (Short) -> Collection<R>) : Collection<R> {
|
||||
for (element in this) {
|
||||
val list = transform(element)
|
||||
if (list != null) {
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
for (r in list) result.add(r)
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -172,7 +170,7 @@ public inline fun <R> ShortArray.foldRight(initial: R, operation: (Short, R) ->
|
||||
* @includeFunctionBody ../../test/CollectionTest.kt reduce
|
||||
*/
|
||||
public inline fun ShortArray.reduce(operation: (Short, Short) -> Short): Short {
|
||||
val iterator = this.iterator()!!
|
||||
val iterator = this.iterator()
|
||||
if (!iterator.hasNext()) {
|
||||
throw UnsupportedOperationException("Empty iterable can't be reduced")
|
||||
}
|
||||
@@ -226,7 +224,7 @@ public inline fun <K> ShortArray.groupByTo(result: MutableMap<K, MutableList<Sho
|
||||
public inline fun ShortArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String {
|
||||
val buffer = StringBuilder()
|
||||
appendString(buffer, separator, prefix, postfix, limit, truncated)
|
||||
return buffer.toString()!!
|
||||
return buffer.toString()
|
||||
}
|
||||
|
||||
/** Returns a list containing the everything but the first elements that satisfy the given *predicate* */
|
||||
|
||||
Reference in New Issue
Block a user