Java Properties convert to Map

Description

Java Properties convert to Map


import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class Main {
  public static void main(String args[]) {

    Properties prop = new Properties();

    prop.setProperty("CSS", "style");
    prop.setProperty("HTML", "tag");
    prop.setProperty("Java", "backend");
    prop.setProperty("Javascript", "frontend");

    HashMap<String, String> propMap = new HashMap<String, String>((Map) prop);

    System.out.println(propMap);/*from w ww. j  av a2 s.c om*/
    
  }
}



PreviousNext

Related