Click here.
- Object last(): This method will return last element in TreeSet if TreeSet is not null else it will throw NoSuchElementException.
In case if there is no element in the TreeSet you should output ‘-1’.
Click here.
In case if there is no element in the TreeSet you should output ‘-1’.