Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

7
LINES

< > BotCompany Repo | #1003332 // stdHash - field-based object hash function

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2081L/13K).

static int stdHash(O a, S... fields) {
  if (a == null) ret 0;
  int hash = getClassName(a).hashCode();
  for (S field : fields)
    hash = boostHashCombine(hash, hashCode(getOpt(a, field)));
  ret hash;
}

Author comment

Began life as a copy of #1002051

download  show line numbers  debug dex  old transpilations   

Travelled to 20 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lnbujpyubztb, lpdgvwnxivlt, mqqgnosmbjvj, mqsvbyillbrs, onxytkatvevr, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1003332
Snippet name: stdHash - field-based object hash function
Eternal ID of this version: #1003332/6
Text MD5: 678d3a6fc6e5cf18e11312203799c103
Transpilation MD5: f8ea22762de819449db8ab059daedc0e
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-12 22:07:17
Source code size: 211 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 666 / 1478
Version history: 5 change(s)
Referenced in: #1003334 - hashCode - get hash code of object or 0 for null
#1005433 - stdHash2 - field-based object hash function
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1025183 - hashAboutObjects