Comparison method violates its general contract!

You would have encountered this errors in java, when you use compare method to check for object equality. It can lead to unpredictable…