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

MappropertiesToMap(File propsFile)
properties To Map
Map<String, String> map = new HashMap<String, String>();
InputStream inStream = new FileInputStream(propsFile);
Properties props = new Properties();
props.load(inStream);
for (String key : props.stringPropertyNames()) {
    map.put(key, props.getProperty(key));
return props;
...
MappropertiesToMap(String propertiesAsString)
properties To Map
Properties props = new Properties();
props.load(new StringReader(propertiesAsString));
return props.entrySet().stream()
        .collect(Collectors.toMap(e -> e.getKey().toString(), e -> e.getValue().toString()));
MaptoMap(final Properties properties)
Converts a Properties object to a string-to-string Map .
return new AbstractMap<String, String>() {
    @SuppressWarnings({ "unchecked" })
    public Set<Entry<String, String>> entrySet() {
        return (Set) properties.entrySet();
};
MaptoMap(final Properties properties)
Converts a Properties object to a Map <String, String>.
return (Map) properties;
MaptoMap(Properties properties)
Returns a Map for the given Properties object
Map<String, String> answer = new HashMap<>();
if (properties != null) {
    Set<Map.Entry<Object, Object>> entries = properties.entrySet();
    for (Map.Entry<Object, Object> entry : entries) {
        Object value = entry.getValue();
        Object key = entry.getKey();
        if (key != null && value != null) {
            answer.put(key.toString(), value.toString());
...
MaptoMap(Properties properties)
Convert a properties instance to a string map.
Map<String, String> out = new HashMap<>(properties.size());
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
    out.put(entry.getKey().toString(), entry.getValue().toString());
return out;
MaptoMap(Properties properties)
to Map
if (properties == null) {
    return new HashMap<String, String>(0);
Map<String, String> map = new HashMap<String, String>(properties.size());
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
    map.put(entry.getKey().toString(), entry.getValue().toString());
return map;
...
MaptoMap(Properties properties)
to Map
Map<Object, Object> m = new HashMap<Object, Object>();
if (null != properties) {
    for (Object key : properties.keySet()) {
        m.put(key, properties.get(key));
return m;
MaptoMap(Properties properties)
Copies all elements from properties into a Map.
if (properties == null || properties.isEmpty())
    return emptyMap();
Map<String, String> props = new HashMap<String, String>(properties.size());
putAll(properties, props);
return props;
MaptoMap(Properties properties)
to Map
Map<String, String> map = new HashMap<String, String>();
if (properties == null) {
    return map;
for (Object key : properties.keySet()) {
    map.put((String) key, properties.getProperty((String) key));
return map;
...