Created
May 1, 2015 15:58
-
-
Save owainlewis/3c64c03c2d4ba68ee5b0 to your computer and use it in GitHub Desktop.
Scala map to Java properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Properties | |
object PropertyBuilder { | |
/** | |
* Build a java Properties instance from a Scala Map | |
* | |
* @param properties An immutable map of properties | |
*/ | |
def buildFromMap(properties: Map[String, String]) = | |
(new Properties /: properties) { | |
case (a, (k, v)) => | |
a.put(k,v) | |
a | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment