Replace deprecated reverse method usages.
This commit is contained in:
@@ -548,49 +548,49 @@ public fun <T : Comparable<T>> Array<out T>.sortedDescending(): List<T> {
|
||||
* Returns a list of all elements sorted descending according to their natural sort order.
|
||||
*/
|
||||
public fun ByteArray.sortedDescending(): List<Byte> {
|
||||
return copyOf().apply { sort() }.reverse()
|
||||
return copyOf().apply { sort() }.reversed()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements sorted descending according to their natural sort order.
|
||||
*/
|
||||
public fun CharArray.sortedDescending(): List<Char> {
|
||||
return copyOf().apply { sort() }.reverse()
|
||||
return copyOf().apply { sort() }.reversed()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements sorted descending according to their natural sort order.
|
||||
*/
|
||||
public fun DoubleArray.sortedDescending(): List<Double> {
|
||||
return copyOf().apply { sort() }.reverse()
|
||||
return copyOf().apply { sort() }.reversed()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements sorted descending according to their natural sort order.
|
||||
*/
|
||||
public fun FloatArray.sortedDescending(): List<Float> {
|
||||
return copyOf().apply { sort() }.reverse()
|
||||
return copyOf().apply { sort() }.reversed()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements sorted descending according to their natural sort order.
|
||||
*/
|
||||
public fun IntArray.sortedDescending(): List<Int> {
|
||||
return copyOf().apply { sort() }.reverse()
|
||||
return copyOf().apply { sort() }.reversed()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements sorted descending according to their natural sort order.
|
||||
*/
|
||||
public fun LongArray.sortedDescending(): List<Long> {
|
||||
return copyOf().apply { sort() }.reverse()
|
||||
return copyOf().apply { sort() }.reversed()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all elements sorted descending according to their natural sort order.
|
||||
*/
|
||||
public fun ShortArray.sortedDescending(): List<Short> {
|
||||
return copyOf().apply { sort() }.reverse()
|
||||
return copyOf().apply { sort() }.reversed()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -589,7 +589,7 @@ class CollectionTest {
|
||||
}
|
||||
|
||||
test fun sortedWith() {
|
||||
val comparator = compareBy<String> { it.toUpperCase().reverse() }
|
||||
val comparator = compareBy<String> { it.toUpperCase().reversed() }
|
||||
val data = listOf("cat", "dad", "BAD")
|
||||
|
||||
expect(listOf("BAD", "dad", "cat")) { data.sortedWith(comparator) }
|
||||
|
||||
@@ -333,7 +333,7 @@ public class SequenceTest {
|
||||
}
|
||||
|
||||
test fun sortedWith() {
|
||||
val comparator = compareBy { s: String -> s.reverse() }
|
||||
val comparator = compareBy { s: String -> s.reversed() }
|
||||
assertEquals(listOf("act", "wast", "test"), sequenceOf("act", "test", "wast").sortedWith(comparator).toList())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user