Added hashCode method in pairs with equals method and rewrite