I have a method that convert Properties into hashmap in this way (i know it's wrong)
Map<String, String> mapProp = new HashMap<String, String>();
Properties prop = new Properties();
prop.load(new FileInputStream( path ));
prop.forEach( (key, value) -> {mapProp.put( (String)key, (String)value );} );
return mapProp;
My idea is that mapping in a way like this:
Properties prop = new Properties();
prop.load(new FileInputStream( path ));
Map<String, String> mapProp = prop.entrySet().stream().collect( /*I don't know*/ );
return mapProp;
How write a lambda expression for do that?
Thanks all in advance
Andrea.