Skip to content

Instantly share code, notes, and snippets.

@roshan
Created April 17, 2015 09:04
Show Gist options
  • Save roshan/7b7fff349e3ed06322c3 to your computer and use it in GitHub Desktop.
Save roshan/7b7fff349e3ed06322c3 to your computer and use it in GitHub Desktop.
The hashCode function generated avoiding auto-boxing and using static functions
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 31 + 1231;
hashCode = hashCode * 31 + ((boole) ? 1231 : 1237);
hashCode = hashCode * 31 + 1231;
hashCode = hashCode * 31 + Byte.hashCode(single_byte);
hashCode = hashCode * 31 + 1231;
hashCode = hashCode * 31 + shrt;
hashCode = hashCode * 31 + 1231;
hashCode = hashCode * 31 + integ;
hashCode = hashCode * 31 + 1231;
hashCode = hashCode * 31 + Long.hashCode(longue);
hashCode = hashCode * 31 + 1231;
hashCode = hashCode * 31 + Double.hashCode(f64);
hashCode = hashCode * 31 + ((isSetStr()) ? 1231 : 1237);
boolean present_str = true && (isSetStr());
if (present_str)
hashCode = hashCode * 31 + str.hashCode();
hashCode = hashCode * 31 + ((isSetBin()) ? 1231 : 1237);
boolean present_bin = true && (isSetBin());
if (present_bin)
hashCode = hashCode * 31 + bin.hashCode();
hashCode = hashCode * 31 + ((isSetEn()) ? 1231 : 1237);
boolean present_en = true && (isSetEn());
if (present_en)
hashCode = hashCode * 31 + en.getValue();
hashCode = hashCode * 31 + ((isSetStru()) ? 1231 : 1237);
boolean present_stru = true && (isSetStru());
if (present_stru)
hashCode = hashCode * 31 + stru.hashCode();
hashCode = hashCode * 31 + ((isSetUn()) ? 1231 : 1237);
boolean present_un = true && (isSetUn());
if (present_un)
hashCode = hashCode * 31 + un.hashCode();
hashCode = hashCode * 31 + 1231;
hashCode = hashCode * 31 + intid;
hashCode = hashCode * 31 + ((isSetBinid()) ? 1231 : 1237);
boolean present_binid = true && (isSetBinid());
if (present_binid)
hashCode = hashCode * 31 + binid.hashCode();
hashCode = hashCode * 31 + ((isSetStrid()) ? 1231 : 1237);
boolean present_strid = true && (isSetStrid());
if (present_strid)
hashCode = hashCode * 31 + strid.hashCode();
return hashCode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment