How to convert Java Properties to HashMap?

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


No comments:

Post a Comment

Model Context Protocol (MCP) — Complete Guide for Backend Engineers

  Model Context Protocol (MCP) — Complete Guide for Backend Engineers Build Tools, Resources, and AI-Driven Services Using LangChain Moder...

Featured Posts