Coding Set 4
Coding Set 4
6. Reverse a List
Problem:
• Given a List<String>, reverse its elements.
Hint: Use Collections.reverse().
o pop()
o peek()
o isEmpty()
Hint: Use ArrayDeque<Integer> with addFirst() and removeFirst().
Implementation Hints:
• Use a HashMap<Integer, Student> where the key is the student's id and the value
is the Student object.
• Use Collections.sort() with a Comparator to sort students by marks.
• Implement the operations inside a menu-driven program using a Scanner for user
input.
6. Exit
Enter your choice: 1