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

17
LINES

< > BotCompany Repo | #1033221 // fieldObjectsInFieldOrder

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

Libraryless. Click here for Pure Java version (3894L/23K).

static Set<Field> fieldObjectsInFieldOrder(Class c, Set<Field> fields) {
  try {
    var byName = mapToKey(f -> f.getName(), fields);
    new LinkedHashSet<Field> out;
    fOr (S name : getFieldOrder(c)) {
      Field f = byName.get(name);
      if (f != null) {
        byName.remove(name);
        out.add(f);
      }
    }
    addAll(out, fields);
    ret out;
  } catch print {
    ret fields;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033221
Snippet name: fieldObjectsInFieldOrder
Eternal ID of this version: #1033221/3
Text MD5: 9e97c7b9ca44e91bc240d45445c9a134
Transpilation MD5: 7c360c0db09bc8335d3a81a441e70fc5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-16 05:24:25
Source code size: 419 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 148 / 207
Version history: 2 change(s)
Referenced in: [show references]