Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Collection;
import java.util.Map;

public class Main {
    public static void rename(Collection<Map<String, Object>> collection, Map<String, String> renames) {
        for (Map<String, Object> map : collection) {
            Object obj;
            for (String originalName : renames.keySet()) {
                if (map.containsKey(originalName)) {
                    obj = map.get(originalName);
                    //Must remove first then added after
                    map.remove(originalName);
                    map.put(renames.get(originalName), obj);
                }
            }

        }
    }
}