private static void addOrderAndDefinitionToMap(
     final List<SweField> fields, final Map<Integer, String> valueOrder) {
   for (int i = 0; i < fields.size(); i++) {
     final SweAbstractDataComponent element = fields.get(i).getElement();
     if (element instanceof SweAbstractSimpleType) {
       final SweAbstractSimpleType<?> simpleType = (SweAbstractSimpleType<?>) element;
       if (simpleType.isSetDefinition()) {
         addValueToValueOrderMap(valueOrder, i, simpleType.getDefinition());
       }
     }
   }
 }
 /**
  * Check fields for definition and return the position
  *
  * @param fields Fields list to check
  * @param definition Definition to check
  * @return Position of the element with the definition or -1 if it is not contained
  */
 public static int checkFields(final List<SweField> fields, final String definition) {
   int i = 0;
   for (final SweField f : fields) {
     final SweAbstractDataComponent element = f.getElement();
     if (element instanceof SweAbstractSimpleType) {
       final SweAbstractSimpleType<?> simpleType = (SweAbstractSimpleType<?>) element;
       if (simpleType.isSetDefinition() && simpleType.getDefinition().equals(definition)) {
         return i;
       }
     }
     ++i;
   }
   return -1;
 }