How to transform these values in an array list and sort it based on descending order using a single function
var a =[1,2,3]
Each value in the list should be multiplied by 3
ExpectedResult=[9,4,3]
It should be as simple as this
var a = listOf(1, 2, 3);
var expectedResult = a.map { it -> it * 3 }.sortedDescending();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.