集册 Java实例教程 将java.util.Map转换为java.util.Properties

将java.util.Map转换为java.util.Properties

欢马劈雪     最近更新时间:2020-01-02 10:19:05

497
将java.util.Map转换为java.util.Properties


//package com.nowjava;
/**
 from
* 时代Java - nowjava.com 
**/


import java.util.Map;

import java.util.Properties;


public class Main {

    /**

     * Converts java.util.Map into java.util.Properties

     * @param map Map to convert

     * @return Properties, created from given map

     */

    public static Properties asProperties(Map<Object, Object> map) {

        Properties properties = new Properties();

        properties.putAll(map);

        return properties;

    }

}