Java Properties to Map toMap(Properties properties)

Here you can find the source of toMap(Properties properties)

Description

to Map

License

Apache License

Declaration

public static Map<String, String> toMap(Properties properties) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static Map<String, String> toMap(Properties properties) {
        if (properties == null) {
            return new HashMap<String, String>(0);
        }// w w w . ja  va2s.  co  m
        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;
    }

    public static <K, V> V getValue(Map<K, V> map, K key) {
        if (map == null) {
            return null;
        }
        return map.get(key);
    }
}

Related

  1. propertiesToMap(String propertiesAsString)
  2. toMap(final Properties properties)
  3. toMap(final Properties properties)
  4. toMap(Properties properties)
  5. toMap(Properties properties)
  6. toMap(Properties properties)
  7. toMap(Properties properties)
  8. toMap(Properties properties)
  9. toMap(Properties properties)