static void zeroAllFieldsOfTypeExcept(O o, Class type, S... exceptions) { zeroAllFieldsOfTypeExcept(o, type, asSet(exceptions)); } static void zeroAllFieldsOfTypeExcept(O o, Class type, Collection<S> exceptions) { Set<S> set = asSet(exceptions); for (S field : allFields(o)) if (!set.contains(field) && instanceOf(getOpt(o, field), type)) set(o, field, null); }
Began life as a copy of #1016358
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019369 |
Snippet name: | zeroAllFieldsOfTypeExcept - set all fields with a value of a certain type to null |
Eternal ID of this version: | #1019369/2 |
Text MD5: | 1b5581db64cf2da6ec17c1ccebd1240b |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-04 19:13:34 |
Source code size: | 387 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 310 / 352 |
Version history: | 1 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |