1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.codehaus.gmaven.plugin.util;
17
18 import java.util.Enumeration;
19 import java.util.HashMap;
20 import java.util.Map;
21 import java.util.Properties;
22
23 import static com.google.common.base.Preconditions.checkNotNull;
24
25
26
27
28
29
30 public class Maps2
31 {
32 private Maps2() {
33
34 }
35
36 public static Map<String,String> fromProperties(final Properties properties) {
37 checkNotNull(properties);
38 Map<String,String> result = new HashMap<String, String>(properties.size());
39 Enumeration names = properties.propertyNames();
40 while (names.hasMoreElements()) {
41 String name = (String)names.nextElement();
42 result.put(name, properties.getProperty(name));
43 }
44 return result;
45 }
46 }