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.Map;
import java.util.Properties;
import java.util.Set;
import java.util.Map.Entry;

public class Main {

    public static Map<String, String> convertProperties2Map(Properties properties) {
        if (properties == null) {
            return null;
        }

        Map<String, String> map = new LinkedHashMap<String, String>();
        Set<Entry<Object, Object>> entrySet = properties.entrySet();
        for (Entry<Object, Object> entry : entrySet) {
            map.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
        }

        return map;
    }
}