Here you can find the source of toProperties(final Map map)
Parameter | Description |
---|---|
map | the map to convert to a Properties object, may not be null |
public static Properties toProperties(final Map map)
//package com.java2s; import java.util.*; public class Main { /**/*from w w w. java 2 s . co m*/ * Gets a new Properties object initialised with the values from a Map. * A null input will return an empty properties object. * * @param map the map to convert to a Properties object, may not be null * @return the properties object */ public static Properties toProperties(final Map map) { Properties answer = new Properties(); if (map != null) { for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); Object key = entry.getKey(); Object value = entry.getValue(); answer.put(key, value); } } return answer; } }