Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class Main {
    /*******
     * It is easy to accidentally create GStrings instead of String in a groovy file. This will auto correct the problem
     * for byon node definitions by calling the toString() methods for map keys and values.
     *
     * @param originalNodesList
     *            .
     * @return the
     */
    public static List<Map<String, String>> convertToStringMap(final List<Map<Object, Object>> originalNodesList) {
        List<Map<String, String>> nodesList;
        nodesList = new LinkedList<Map<String, String>>();

        for (final Map<Object, Object> originalMap : originalNodesList) {
            final Map<String, String> newMap = new LinkedHashMap<String, String>();
            final Set<Entry<Object, Object>> entries = originalMap.entrySet();
            for (final Entry<Object, Object> entry : entries) {
                newMap.put(entry.getKey().toString(), entry.getValue().toString());
            }
            nodesList.add(newMap);

        }
        return nodesList;
    }
}