MCPcopy Create free account
hub / github.com/antlr/codebuff / fromProperties

Method fromProperties

output/java_guava/1.4.16/Maps.java:1301–1309  ·  view source on GitHub ↗

Creates an ImmutableMap from a Properties instance. Properties normally derive from Map , but they typically contain strings, which is awkward. This method lets you get a plain-old-Map out of a Properties. @param properties a {@

(Properties properties)

Source from the content-addressed store, hash-verified

1299 */
1300
1301 @GwtIncompatible // java.util.Properties
1302 public static ImmutableMap<String, String> fromProperties(Properties properties) {
1303 ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
1304 for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) {
1305 String key = (String) e.nextElement();
1306 builder.put(key, properties.getProperty(key));
1307 }
1308 return builder.build();
1309 }
1310
1311 /**
1312 * Returns an immutable map entry with the specified key and value. The {@link

Callers

nothing calls this directly

Calls 6

builderMethod · 0.95
putMethod · 0.65
getPropertyMethod · 0.65
hasMoreElementsMethod · 0.45
nextElementMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected