Java Properties to Map toMap(Properties props, String prefix)

Here you can find the source of toMap(Properties props, String prefix)

Description

to Map

License

Apache License

Declaration

public static Map<String, String> toMap(Properties props, String prefix) 

Method Source Code

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

import java.util.Properties;
import java.util.Map;
import java.util.HashMap;

public class Main {
    public static Map<String, String> toMap(Properties props, String prefix) {
        Map<String, String> map = new HashMap<>();
        for (String key : props.stringPropertyNames()) {
            if (key.startsWith(prefix)) {
                map.put(key.substring(prefix.length()), props.getProperty(key));
            }/*  w  w w . j  a  v a2 s  .c o  m*/
        }
        return map;
    }
}

Related

  1. toMap(Properties properties)
  2. toMap(Properties props)
  3. toMap(Properties props)
  4. toMap(Properties props)
  5. toMap(Properties props)
  6. toMap(Properties sourceProperties)