Libraryless. Click here for Pure Java version (10459L/58K).
static <A> A resetFields(A object, S fields) { if (object != null) { O emptyInstance = newInstance(object.getClass()); resetFields(object, fields, emptyInstance); } ret object; } static <A> A resetFields(A object, S fields, O emptyInstance) { for (S field : identifiers(fields)) setOpt(object, field, getOpt(emptyInstance, field)); ret object; }
Began life as a copy of #1024027
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): elmgxqgtpvxh, mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
| Snippet ID: | #1036232 |
| Snippet name: | resetFields |
| Eternal ID of this version: | #1036232/7 |
| Text MD5: | 2c6fdd4c42a24cfaeda3d746995edd1e |
| Transpilation MD5: | a5a7d319940b009bbca1965c3816b617 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2023-03-20 20:36:03 |
| Source code size: | 380 bytes / 13 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 850 / 1045 |
| Version history: | 6 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |