Is there anything wrong with the above code?
Yes, 2 things — firstly, the above sort is case sensitive, that is the uppercase takes priority over lowercase pushing ‘Java’ after ‘JSP’. Secondly, if the collection had any null values, it will throw a NullpointerException. These two issues can be rectified by providing a custom sorting implementation that ignores case and handles null values … Read more