Here you can find the source of toMap(Properties props, String prefix)
public static Map<String, String> toMap(Properties props, String prefix)
//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; } }