Last active
December 17, 2015 22:49
-
-
Save joeRinehart/5684746 to your computer and use it in GitHub Desktop.
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
def someKindaClassProcessorMap = [ | |
(String) : new StringProcessor(), | |
(Date) : new DateProcessor() | |
] |
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
def someMap = [ | |
("${someVariableContainingTheKeyName}") : "someValue" | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can simplify that to something like this:
There is no need to wrap the key value in a GroovyString. Surrounding any expression with parens in that spot will cause the expression to be evaluated and whatever the expression evaluates to will be the key. If you leave the parens off, the literal "someVariableContainingTheKeyName" will be the key, which is not what you want in this case.