Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class Main {
    /**
     * Converts a Properties object into a Map.
     * 
     * @param properties
     *            set of string key-value pairs
     * @returns map of key-value pairs (never null)
     */
    public static Map<String, String> getMapFromProperties(Properties props) {
        Map<String, String> map = new HashMap<String, String>();

        if (props != null) {
            Enumeration<Object> e = props.keys();
            while (e.hasMoreElements()) {
                String s = (String) e.nextElement();
                map.put(s, props.getProperty(s));
            }
        }

        return map;
    }
}