You are viewing an old version of this page. View the current version. Compare with Current · View Page History
- Strings are not Lists. In the JVM java.lang.String does not implement java.util.List.
- Arrays are not Lists. In the JVM arrays and java.util.List are quite different. In Groovy we support both as different types to ensure we interoperate cleanly with Java code, though we try wherever possible to make them interchangable and appear polymorphic.
- Maps override the dot operator, so
myMap.sizewill return null unless you have a value for
- In map literals, all keys are interpreted as strings by default! If you want to use a variable or other literal as a key, use parentheses like so:
myMap = [(var1):val, (var2):val]
- See the Maps user guide