Before downcasting, check for the dynamic type of the object and then downcast.
StringBuffer str = new StringBuffer("Hello");
Object obj = str;
if(obj instanceof String)
{
String strBuf = (String) obj;
}
Purpose of the blog is to learn things while you working. There are may things we do but we don't know the implementation and importance of those things. Lets learn those things
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
The implementation was adapted from Tim Peters's list sort for Python ( TimSort). It uses techniques from Peter McIlroy's "Optimistic Sorting and Information Theoretic Complexity", in Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp 467-474, January 1993.