Searching...
Friday, 14 March 2014

How to convert Java Properties to HashMap?

11:41
package com.pretech;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class PropertiesToHashMap {
	public static void main(String args[]) {
		Properties properties = new Properties();
		properties.put("name", "Raj");
		Map<String, String> map = new HashMap<String, String>((Map) properties);
		System.out.println("Name is :" + map.get("name"));
	}
}

Output



Name is :Raj


0 comments: