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

Method fromProperties

corpus/java/training/guava/collect/Maps.java:1272–1282  ·  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

1270 * null
1271 */
1272 @GwtIncompatible // java.util.Properties
1273 public static ImmutableMap<String, String> fromProperties(Properties properties) {
1274 ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
1275
1276 for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements(); ) {
1277 String key = (String) e.nextElement();
1278 builder.put(key, properties.getProperty(key));
1279 }
1280
1281 return builder.build();
1282 }
1283
1284 /**
1285 * 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