Stdlib update due ONLY_LOCAL_RETURN diagnostic
This commit is contained in:
@@ -134,7 +134,7 @@ public fun <T> Iterable<T>.sortBy(comparator: Comparator<T>): List<T> {
|
||||
/**
|
||||
* 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(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 sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> order(x).compareTo(order(y)) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
@@ -144,7 +144,7 @@ public inline fun <T, R : Comparable<R>> Array<out T>.sortBy(order: (T) -> R): L
|
||||
/**
|
||||
* Returns a sorted list of all elements, ordered by results of specified *order* function.
|
||||
*/
|
||||
public inline fun <T, R : Comparable<R>> Iterable<T>.sortBy(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 sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> order(x).compareTo(order(y)) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
@@ -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.
|
||||
*/
|
||||
public inline fun <T, R : Comparable<R>> Array<out T>.sortDescendingBy(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 sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -order(x).compareTo(order(y)) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
@@ -174,7 +174,7 @@ public inline fun <T, R : Comparable<R>> Array<out T>.sortDescendingBy(order: (T
|
||||
/**
|
||||
* 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(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 sortBy: Comparator<T> = comparator<T> {(x: T, y: T) -> -order(x).compareTo(order(y)) }
|
||||
java.util.Collections.sort(sortedList, sortBy)
|
||||
|
||||
@@ -100,7 +100,7 @@ public fun <T> Iterator<T>.filter(predicate: (T) -> Boolean) : Iterator<T> {
|
||||
* Returns an iterator over elements which don't match the given *predicate*
|
||||
*/
|
||||
deprecated("Replace Iterator<T> with Stream<T> by using stream() function instead of iterator()")
|
||||
public inline fun <T> Iterator<T>.filterNot(predicate: (T) -> Boolean) : Iterator<T> {
|
||||
public inline fun <T> Iterator<T>.filterNot(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) predicate: (T) -> Boolean) : Iterator<T> {
|
||||
return filter {!predicate(it)}
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ public fun <T> Iterator<T>.reverse() : List<T> {
|
||||
* E.g. arrayList("two" to 2, "one" to 1).sortBy({it.second}) returns list sorted by second element of pair
|
||||
*/
|
||||
deprecated("Replace Iterator<T> with Stream<T> by using stream() function instead of iterator()")
|
||||
public inline fun <T, R: Comparable<R>> Iterator<T>.sortBy(f: (T) -> R) : List<T> {
|
||||
public inline fun <T, R: Comparable<R>> Iterator<T>.sortBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) f: (T) -> R) : List<T> {
|
||||
val sortedList = toCollection(ArrayList<T>())
|
||||
val sortBy: Comparator<T> = comparator<T> {(x: T, y: T) ->
|
||||
val xr = f(x)
|
||||
|
||||
Reference in New Issue
Block a user