Sorting sequences

Report a typo

Implement a method for sorting a sequence of integer numbers in descending order. The method must modify the given sequence represented as a list.

Try to use standard methods for processing collections.

Do not output the elements of the list, just modify the collection.

Sample Input 1:

10 13 22 14

Sample Output 1:

22 14 13 10
Write a program in Java 17
import java.util.*;
import java.util.stream.Collectors;

public class Main {

public static void sortInDescendingOrder(List<Integer> sequence) {
// write your code here
}

/* Do not change code below */
public static void main(String[] args) {
final Scanner scanner = new Scanner(System.in);
final List<Integer> seq = Arrays.stream(scanner.nextLine().split("\\s+"))
.map(Integer::parseInt)
.collect(Collectors.toList());
sortInDescendingOrder(seq);
seq.forEach(e -> System.out.print(e + " "));
}
}
___

Create a free account to access the full topic