List of utility methods to do Properties to Map
Map,?> | propertiesToMap(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; ... |
Map | propertiesToMap(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())); |
Map | toMap(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(); }; |
Map | toMap(final Properties properties) Converts a Properties object to a Map <String, String> .
return (Map) properties;
|
Map | toMap(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()); ... |
Map | toMap(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; |
Map | toMap(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; ... |
Map | toMap(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; |
Map | toMap(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; |
Map | toMap(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; ... |