Skip to content

Instantly share code, notes, and snippets.

@owainlewis
Created May 1, 2015 15:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save owainlewis/3c64c03c2d4ba68ee5b0 to your computer and use it in GitHub Desktop.
Save owainlewis/3c64c03c2d4ba68ee5b0 to your computer and use it in GitHub Desktop.
Scala map to Java properties
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