Do not create empty list when reversing empty collection or array — use singleton empty list instead.
#KT-8099 Fixed
This commit is contained in:
@@ -10,6 +10,16 @@ fun ordering(): List<GenericFunction> {
|
||||
returns { "List<T>" }
|
||||
body {
|
||||
"""
|
||||
if (this is Collection<*> && isEmpty()) return emptyList()
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
"""
|
||||
}
|
||||
|
||||
body(ArraysOfObjects, ArraysOfPrimitives) {
|
||||
"""
|
||||
if (isEmpty()) return emptyList()
|
||||
val list = toArrayList()
|
||||
Collections.reverse(list)
|
||||
return list
|
||||
|
||||
Reference in New Issue
Block a user