Method {@code convertToMap} converts an {@code Environment} to a nested Map which
represents a yml/json structure.
@param input the environment to be converted
@return the nested map containing the environment's properties
978698
private Map<String, Object> convertToMap(Environment input) {
		// First use the current convertToProperties to get a flat Map from the
		// environment
		Map<String, Object> properties = convertToProperties(input);

		// The root map which holds all the first level properties
		Map<String, Object> rootMap = new LinkedHashMap<>();
		for (Map.Entry<String, Object> entry : properties.entrySet()) {
			String key = entry.getKey();
			Object value = entry.getValue();
			PropertyNavigator nav = new PropertyNavigator(key);
			nav.setMapValue(rootMap, value);
		}
		return rootMap;
	}
277271
public static DTree getDTreeFromCoNLLXString(final String input) {
        if (input == null || input.trim().isEmpty()) {
            return null;
        }

        Map<Integer, Map<Integer, String>> semanticHeadsMap = new HashMap<>();
        String[] dNodesString = input.split(System.lineSeparator());
        DTree tree = new DTree();

        Arrays.stream(dNodesString)
                .map(s -> s.split("\t"))
                .forEachOrdered(fields -> {
                    int currentIndex = 0;
                    int id = Integer.parseInt(fields[currentIndex++]);
                    String form = fields[currentIndex++];
                    String lemma = fields[currentIndex++];
                    String cPOSTag = fields[currentIndex++];
                    String pos = fields[currentIndex++];
                    String feats = fields[currentIndex++];
                    Map<String, String> featsMap = null;
                    if (!feats.equals("_")) {
                        featsMap = Arrays.stream(feats.split("\\|"))
                                .map(entry -> entry.split("="))
                                .collect(Collectors.toMap(e -> e[0], e -> e.length > 1 ? e[1] : StringUtils.EMPTY));
                    } else {
                        featsMap = new HashMap<>();
                    }

                    String headIndex = fields[currentIndex++];
                    String depLabel = fields[currentIndex++];

                    String dump1 = fields[currentIndex++];
                    String dump2 = fields[currentIndex++];

                    String semanticHeadsString = currentIndex >= fields.length ? "_" : fields[currentIndex];

                    if (!semanticHeadsString.equals("_")) {
                        Map<Integer, String> semanticHeads = Arrays.stream(semanticHeadsString.split("\\|"))
                                .map(entry -> entry.split(":"))
                                .collect(Collectors.toMap(e -> Integer.parseInt(e[0]), e -> (e.length > 1) ? e[1] : StringUtils.EMPTY));
                        semanticHeadsMap.put(id, semanticHeads);
                    }

                    DNode node = id == 0 ? tree.getPaddingNode() : new DNode(id, form, lemma, cPOSTag, pos, depLabel);
                    if (id == 0 && !featsMap.containsKey("uuid")) {
                        featsMap.put("uuid", tree.getUUID().toString());
                    }
                    node.setFeats(featsMap);
                    node.addFeature("head", headIndex); // by the time head might not be generated!
                    if (node.getId() == 0) {
                        tree.getPaddingNode().setFeats(node.getFeats());// Substitute padding with actual 0 node from CoNLLX
                    } else {
                        tree.add(node);
                    }
                });

        tree.getPaddingNode().getFeats().remove("head");
        for (int i = 1; i < tree.size(); i++) {
            DNode node = tree.get(i);
            int headIndex = Integer.parseInt(node.getFeature("head"));
            DNode head = tree.get(headIndex);
            head.addChild(node);
            node.getFeats().remove("head");
            node.setHead(head);
        }


        // Recover semantic heads.
        semanticHeadsMap.entrySet().parallelStream().map(e -> {
            DNode node = tree.get(e.getKey());
            Map<Integer, String> nodeSemanticInfo = e.getValue();
            for (Integer id : nodeSemanticInfo.keySet()) {
                node.addSemanticHead(tree.get(id), nodeSemanticInfo.get(id));
                tree.get(id).getSemanticChildren().add(node);
            }
            return null;
        }).collect(Collectors.toList());
        return tree;
    }
165685
public static Map<String, String> toStringStringMap(Map input) {
        Map<String, String> map = new HashMap<>();
        for (Object o : input.keySet()) {
            map.put(o.toString(), input.get(o) != null ? input.get(o).toString() : "");
        }
        return map;
    }
370371
public static String toConverterPreferenceValue(Iterator<String> input) {
		final StringBuilder builder = new StringBuilder();
		while (input.hasNext()) {
			final String value = input.next();
			if (builder.length() > 0) {
				builder.append(PREFERENCE_SEPARATOR);
			}
			builder.append(value);
		}
		return builder.toString();
	}
833224
public MultiLineStringTo toTransferObject(MultiLineString input) {
        MultiLineStringTo result = new MultiLineStringTo();
        double[][][] resultCoordinates = new double[input.getNumGeometries()][][];
        for (int i = 0; i < input.getNumGeometries(); i++) {
            resultCoordinates[i] = getPoints(input.getGeometryN(i));
        }
        result.setCoordinates(resultCoordinates);
        result.setCrs(GeoJsonTo.createCrsTo("EPSG:" + input.getSRID()));
        return result;
    }
754763
public static String replaceDataReferencesInString(final String input, final Map<String, Map<String, String>> data) {
        return replaceDataReferencesInString(input, data, null, false);
    }
1244978
@Override
    public Object map(Object input) {
        String orig = input.toString();
        if (map.containsKey(orig)) {
            return map.get(orig);
        }

        if (input instanceof String)
            return input;
        else
            return orig;
    }
1189712
@Override
    public List<String> applyToMap( Map<String, Object> inputMap ) {
        if ( inputMap == null ) {
            return null;
        }

        List<String> keysToBeRemoved = new LinkedList<>();

        if ( pathElement instanceof LiteralPathElement ) {

            // if we are a literal, check to see if we match
            if ( inputMap.containsKey( pathElement.getRawKey() ) ) {
                keysToBeRemoved.add( pathElement.getRawKey() );
            }
        }
        else if ( pathElement instanceof StarPathElement ) {

            StarPathElement star = (StarPathElement) pathElement;

            // if we are a wildcard, check each input key to see if it matches us
            for( String key : inputMap.keySet() ) {

                if ( star.stringMatch( key ) ) {
                    keysToBeRemoved.add( key );
                }
            }
        }

        return keysToBeRemoved;
    }
1143790
function mapToObject(input, mapFunc) {
    const obj = {};
    for (const element of input) {
        obj[element] = mapFunc(element);
    }
    return obj;
}
194779
public static List<String> toList(String[] input) {
        List<String> ret = new ArrayList<>();
        for (int i = 0; i < input.length; i++)
            ret.add(input[i]);
        return ret;
    }
956249
public static Template parse(String input) {
        return new Template(input, Tag.getTags(), Filter.getFilters());
    }
1336295
@Override
    public Object map(Object input) {
        String value = input.toString();
        //Do conversion
        Integer classIdx = statesMap.get(value);
        if (classIdx == null) {
            throw new IllegalStateException("Cannot convert categorical value to integer value: input value (\"" + value
                    + "\") is not in the list of known categories (state names/categories: " + stateNames + ")");
        }
        return classIdx;
    }
828689
@Override
    public Object map(Object input) {
        Number n = (Number) input;
        return doOp(n.intValue());
    }
504075
public GeometryCollectionTo toTransferObject(GeometryCollection input) {
        GeometryCollectionTo result = new GeometryCollectionTo();
        GeoJsonTo[] tos = new GeoJsonTo[input.getNumGeometries()];
        for (int i = 0; i < input.getNumGeometries(); i++) {
            tos[i] = toTransferObject(input.getGeometryN(i));
            tos[i].setCrs(null); // Crs may not be repeated
        }
        result.setGeometries(tos);
        result.setCrs(GeoJsonTo.createCrsTo("EPSG:" + input.getSRID()));
        return result;
    }
101308
private static List<TypeName> convert(List<? extends TypeMirror> input) {
		List<TypeName> result = new ArrayList<TypeName>();

		for (TypeMirror item : input) {
			result.add(TypeUtility.typeName(item));
		}

		return result;
	}
440949
@Override
    public ContainerSection parse(String input) throws Exception {
        super.parse(input);
        features = new ArrayList<FeatureSection>();
        ArrayList<DocumentSection<?>> section = this.getSections().get(Tokens.getFeatureToken());
        if (section != null) {
            for (DocumentSection<?> item : section) {
                features.add((FeatureSection) item);
            }
        }
        return this;
    }
866271
private void convertMapToMap(Map<?, ?> srcMap, Map<Object, Object> targetMap) {
		final ConverterRegistry convert = ConverterRegistry.getInstance();
		Object key;
		Object value;
		for (Entry<?, ?> entry : srcMap.entrySet()) {
			key = TypeUtil.isUnknow(this.keyType) ? entry.getKey() : convert.convert(this.keyType, entry.getKey());
			value = TypeUtil.isUnknow(this.valueType) ? entry.getValue() : convert.convert(this.valueType, entry.getValue());
			targetMap.put(key, value);
		}
	}