Added code for equals method

includes javadoc