Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;

public class Main {
    public static Map<String, String> convert(Properties props) {
        Map<String, String> _result = new HashMap<String, String>();
        Set<Entry<Object, Object>> propsSet = props.entrySet();
        for (Entry<Object, Object> p : propsSet) {
            Object value = p.getValue();
            if (value == null) {
                _result.put(p.getKey().toString(), null);
            } else {
                _result.put(p.getKey().toString(), value.toString());
            }
        }
        return _result;
    }
}