Write a program to get the next element from given inputs by using one of the TreeSet methods.
Note the elements in TreeSet by default sorted in ascending order.
Input (TreeSet, Integer) |
Output (Integer) |
[15, 25, 99, 40, 10, 20, 30], 20 |
25 |
[7, 2, 8, 3, 1, 4, 5, 6], 0 |
1 |
[412, 410, 402, 404, 405, 406, 409, 411], 412 |
null |
[10, 20, 26, 22, 90, 11, 15], 91 |
null |
null |
null |