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).

1  
sbool stdEq_nonTransient(O a, O b) {
2  
  if (a == null) ret b == null;
3  
  if (b == null) ret false;
4  
  if (a.getClass() != b.getClass()) ret false;
5  
  for (S field : nonTransientNonStaticFields(a))
6  
    if (neq(getOpt(a, field), getOpt(b, field)))
7  
      ret false;
8  
  ret true;
9  
}

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: 130 / 181
Version history: 2 change(s)
Referenced in: [show references]