{"id":676,"date":"2005-05-27T14:24:13","date_gmt":"2005-05-27T18:24:13","guid":{"rendered":"http:\/\/wordpress.cephas.net\/?p=676"},"modified":"2005-05-27T14:24:13","modified_gmt":"2005-05-27T18:24:13","slug":"strategy-design-pattern-applied-to-hashcode-and-equals","status":"publish","type":"post","link":"https:\/\/cephas.net\/blog\/2005\/05\/27\/strategy-design-pattern-applied-to-hashcode-and-equals\/","title":{"rendered":"Strategy Design Pattern applied to hashCode() and equals()"},"content":{"rendered":"<p>The latest issue of the <a href=\"http:\/\/www.javaspecialists.co.za\/\">JavaSpecialists newsletter<\/a> (by Dr. Heinz Kabutz) features a lengthy look at possibility of <a href=\"http:\/\/www.javaspecialists.co.za\/archive\/Issue108.html\">applying the Strategy design pattern to the equals() and hashCode() methods<\/a> commonly used in Java. In it he concludes that the equals and hashCode methods autogenerated by IntelliJ Idea are better from a performance standpoint.<\/p>\n<p>If your IDE of choice doesn&#8217;t include the ability to autogenerate the bodies of the above mentioned methods, you might also check out the <a href=\"http:\/\/jakarta.apache.org\/commons\/lang\/api\/org\/apache\/commons\/lang\/builder\/EqualsBuilder.html\">EqualsBuilder<\/a>, <a href=\"http:\/\/jakarta.apache.org\/commons\/lang\/api\/org\/apache\/commons\/lang\/builder\/HashCodeBuilder.html\">HashCodeBuilder<\/a> and <a href=\"http:\/\/jakarta.apache.org\/commons\/lang\/api\/org\/apache\/commons\/lang\/builder\/ToStringBuilder.html\">ToStringBuilder<\/a> classes in the <a href=\"http:\/\/jakarta.apache.org\/commons\/lang\/\">Jakarta Commons Lang<\/a> library.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The latest issue of the JavaSpecialists newsletter (by Dr. Heinz Kabutz) features a lengthy look at possibility of applying the Strategy design pattern to the equals() and hashCode() methods commonly used in Java. In it he concludes that the equals and hashCode methods autogenerated by IntelliJ Idea are better from a performance standpoint. If your &hellip; <a href=\"https:\/\/cephas.net\/blog\/2005\/05\/27\/strategy-design-pattern-applied-to-hashcode-and-equals\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Strategy Design Pattern applied to hashCode() and equals()<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,2],"tags":[],"_links":{"self":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/676"}],"collection":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/comments?post=676"}],"version-history":[{"count":0,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/676\/revisions"}],"wp:attachment":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/media?parent=676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/categories?post=676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/tags?post=676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}