MCPcopy Create free account
hub / github.com/java-native-access/jna / sortFields

Method sortFields

src/com/sun/jna/Structure.java:1004–1015  ·  view source on GitHub ↗

Sort the structure fields according to the given array of names. @param fields list of fields to be sorted @param names list of names representing the desired sort order

(List<Field> fields, List<String> names)

Source from the content-addressed store, hash-verified

1002 * @param names list of names representing the desired sort order
1003 */
1004 protected void sortFields(List<Field> fields, List<String> names) {
1005 for (int i=0;i < names.size();i++) {
1006 String name = names.get(i);
1007 for (int f=0;f < fields.size();f++) {
1008 Field field = fields.get(f);
1009 if (name.equals(field.getName())) {
1010 Collections.swap(fields, i, f);
1011 break;
1012 }
1013 }
1014 }
1015 }
1016
1017 /** Look up all fields in this class and superclasses.
1018 * @return ordered list of public {@link java.lang.reflect.Field} available on

Callers 1

getFieldsMethod · 0.95

Calls 4

getNameMethod · 0.65
sizeMethod · 0.45
getMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected