created a util method to help compute hashcode