Merge Sort algorithm in Java

This is a very simple Java implementation of the popular merge sort algorithm. I decided to put this here because I needed to refresh my knowledge of sorting algorithms, problem is I could not find an easy-to-understand implementation online, so I decided to implement my own version and share it in case someone is struggling... Continue Reading →

Never synchronize on Java boxed primitives

This is another pitfall that can easily compromise a whole application if not understood, it involves thread safety, Java objects immutability and boxed primitives. Standard Java classes like Integer and Long are immutable. A class is said to be immutable if it is implemented in such a way that it's value cannot be changed once... Continue Reading →

How not to compare Strings in Java

In my previous post I wrote about how not to compare Integer and Long objects in Java in order to avoid undefined behaviours in your code caused by the Java interning mechanism. If not well understood interning can lead to catastrophic failures. You may think that your code is working fine while in fact it... Continue Reading →

Create a free website or blog at

Up ↑