public static Map < String , String > loadMap ( File f ) throws IOException { Properties props = new Properties ( ) ; FileInputStream in = new FileInputStream ( f ) ; try { props . load ( in ) ; Map < String , String > map = new HashMap < String , String > ( ) ; Set < Entry < Object , Object > > entrySet = props . entrySet ( ) ; for ( Entry < Object , Object > entry : entrySet ) { // The casts to String should always succeed map . put ( ( String ) entry . getKey ( ) , ( String ) entry . getValue ( ) ) ; } return map ; } finally { try { in . close ( ) ; } catch ( IOException e ) { } } }
Loads a Map from the given Properties file .