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

10
LINES

< > BotCompany Repo | #1019760 // objectToMap_inOrder

JavaX fragment (include)

1  
// o is either a map already (string->object) or an arbitrary object,
2  
// in which case its fields are converted into a map.
3  
static Map<S, O> objectToMap_inOrder(O o) {
4  
  if (o == null) null;
5  
  if (o instanceof Map) ret (Map) o;
6  
  new LinkedHashMap<S, O> map;
7  
  for (S field : fieldsInOrder(o))
8  
    map.put(field, get(o, field));
9  
  ret map;
10  
}

Author comment

Began life as a copy of #1002179

download  show line numbers  debug dex  old transpilations   

Travelled to 10 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019760
Snippet name: objectToMap_inOrder
Eternal ID of this version: #1019760/1
Text MD5: 2d7560d25ee4482114e8d61f3c4cbef8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-25 02:24:33
Source code size: 350 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 315 / 333
Referenced in: [show references]