Java Utililty Methods Properties to Map

List of utility methods to do Properties to Map

Description

The list of methods to do Properties to Map are organized into topic(s).

Method

MaptoMap(Properties properties)
Returns a Map<String, String> out of a Java Properties object.
Map<String, String> result = new HashMap<String, String>(properties.size());
for (Map.Entry<Object, Object> parameter : properties.entrySet()) {
    String value = null;
    if (parameter.getValue() != null) {
        value = parameter.getValue().toString();
    result.put(parameter.getKey().toString(), value);
return result;
MaptoMap(Properties properties)
to Map
Map<String, String> result = new HashMap<String, String>(properties.size());
for (String key : properties.stringPropertyNames()) {
    result.put(key, properties.getProperty(key));
return result;
MaptoMap(Properties props)
to Map
return new HashMap(props);
MaptoMap(Properties props)
to Map
return props == null ? new HashMap<String, String>() : new HashMap<String, String>((Map) props);
MaptoMap(Properties props)
to Map
HashMap<String, V> result = new HashMap<>();
for (String name : props.stringPropertyNames()) {
    result.put(name, (V) props.getProperty(name));
return result;
MaptoMap(Properties props)
to Map
Set<String> names = props.stringPropertyNames();
HashMap<String, Object> map = new HashMap<String, Object>(names.size());
for (String name : names) {
    map.put(name, props.getProperty(name));
return map;
MaptoMap(Properties props, String prefix)
to Map
Map<String, String> map = new HashMap<>();
for (String key : props.stringPropertyNames()) {
    if (key.startsWith(prefix)) {
        map.put(key.substring(prefix.length()), props.getProperty(key));
return map;
MaptoMap(Properties sourceProperties)
Make a Map<String, String> from the supplied Properties, copying all the keys and values.
if (sourceProperties == null) {
    return null;
Map<String, String> configMap = new HashMap<String, String>();
Iterator<?> iter = sourceProperties.keySet().iterator();
while (iter.hasNext()) {
    String key = (String) iter.next();
    configMap.put(key, sourceProperties.getProperty(key));
...