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

9
LINES

< > BotCompany Repo | #1035996 // stdEq_nonTransient - field-based equals function (uses all non-transient fields)

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

Libraryless. Click here for Pure Java version (9216L/51K).

sbool stdEq_nonTransient(O a, O b) {
  if (a == null) ret b == null;
  if (b == null) ret false;
  if (a.getClass() != b.getClass()) ret false;
  for (S field : nonTransientNonStaticFields(a))
    if (neq(getOpt(a, field), getOpt(b, field)))
      ret false;
  ret true;
}

Author comment

Began life as a copy of #1005432

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035996
Snippet name: stdEq_nonTransient - field-based equals function (uses all non-transient fields)
Eternal ID of this version: #1035996/3
Text MD5: 2ec14367e923d88bcd8a3832faa46643
Transpilation MD5: ac5227f9db4ff14a84303b953268a0f5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-21 08:18:32
Source code size: 280 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 67 / 99
Version history: 2 change(s)
Referenced in: [show references]