Here you can find the source of toMap(Properties props)
@SuppressWarnings("unchecked") public static <V> Map<String, V> toMap(Properties props)
//package com.java2s; //License from project: Apache License import java.util.HashMap; import java.util.Map; import java.util.Properties; public class Main { @SuppressWarnings("unchecked") public static <V> Map<String, V> toMap(Properties props) { HashMap<String, V> result = new HashMap<>(); for (String name : props.stringPropertyNames()) { result.put(name, (V) props.getProperty(name)); }/*w w w.j a v a2 s.c o m*/ return result; } }