diff options
Diffstat (limited to 'groovy.html.markdown')
| -rw-r--r-- | groovy.html.markdown | 6 | 
1 files changed, 5 insertions, 1 deletions
| diff --git a/groovy.html.markdown b/groovy.html.markdown index 63cef76b..135efc0f 100644 --- a/groovy.html.markdown +++ b/groovy.html.markdown @@ -51,6 +51,7 @@ println x  /*    Collections and maps  */ +  //Creating an empty list  def technologies = [] @@ -81,9 +82,12 @@ technologies.eachWithIndex { it, i -> println "$i: $it"}  technologies.contains('Groovy')  technologies.containsAll(['Groovy','Grails']) -//Sort a list +// Sort a list (mutates original list)  technologies.sort() +// To sort without mutating original, you can do: +sortedTechnologies = technologies.sort( false ) +  //Replace all elements in the list  Collections.replaceAll(technologies, 'Gradle', 'gradle') | 
