Here you can find the source of propertiesToMap(File propsFile)
public static Map<?, ?> propertiesToMap(File propsFile) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.Properties; public class Main { public static Map<?, ?> propertiesToMap(File propsFile) throws IOException { Map<String, String> map = new HashMap<String, String>(); InputStream inStream = new FileInputStream(propsFile); Properties props = new Properties(); props.load(inStream);/*from ww w . ja va 2 s . c o m*/ for (String key : props.stringPropertyNames()) { map.put(key, props.getProperty(key)); } return props; } }