Skip to content

Instantly share code, notes, and snippets.

@nullren
Created November 20, 2015 00:51
Show Gist options
  • Select an option

  • Save nullren/7ff41496090e7e920e23 to your computer and use it in GitHub Desktop.

Select an option

Save nullren/7ff41496090e7e920e23 to your computer and use it in GitHub Desktop.

Revisions

  1. renning bruns created this gist Nov 20, 2015.
    14 changes: 14 additions & 0 deletions a.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@

    // Lazily initialized, cached hashCode
    private volatile int hashCode = 0; // (See Item 48)

    public int hashCode() {
    if (hashCode == 0) {
    int result = 17;
    result = 37*result + areaCode;
    result = 37*result + exchange;
    result = 37*result + extension;
    hashCode = result;
    }
    return hashCode;
    }