SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Groovy Introduction
Agenda
l
Collections
l
Lists
l
Sets
l
Ranges
l
Maps
Prerequisites
l
Knowledge of Java collections.
l
Basic working of groovy.
l
Working knowledge of Closure.
Groovy Collections

Data structure that helps in dealing with a number of objects.

A wide variety of methods available for easy manipulation.
Lists

A list cares about the index

Elements are assigned indices on the basis of how they are
added

Has methods related to the index

Index starts from 0
Creating list
//create empty list with ech element of type 'def'
List list = [ ]
//create empty list with elements of type 'type'
List<type> list = [ ]
List<type> list = new ArrayList()
Lists
Adding an element
list.add(“element1”)
list << “element1”
list += “element1”
list.push(element)
List firstList = [1,2,3,4,5]
List secondList = [“element2”]
List thirdList = firstList + secondList
println thirdList // [1,2,3,4,5,”element2”]
fourthlist = thirdlist - firstlist
println fourthlist // [“element2”]
Lists
Fetching elements:
list[i] – Get ith element in list starting from 0
list.get(0) – Get first element in list
list.getAt(0) – Get first element in list
list.first() - Get first element of list
list.head() - Get the head of list
list.last() - Get last element of list
list.tail() - Get all elements except first
list.getAt(1..10) – Get elements from index 1 to 10
(includes index 10)
list.subList(1, 10) - Get elements at index 1 to 10 (index
10 excluded)
Lists
Removing duplicates from a List :
list.unique() // Alters original list
list as Set
Deleting an element from a List :
(All of them alter original list)
list.remove(idx)
list.pop()
list.removeAll(collection)
Lists
Convert String into List:
“Hi” as List / “Hi”.toList()
string.tokenize('_') : Splits the string into a list with argument used as
delimiter.
string.split('_') : Same as tokenize but can also accept regular
expressions as delimiters
Convert List into String:
list.join(',')
Lists
Operations on each element of list:
println list*.name // Use of spread operator
list.collect { it.multiply(2) } // what if 'it' refers to string?
list.find { it.name==”abc” } // returns one object
list.findAll { it.name==”abc” } // returns list
list.each { println it.name }
list.eachWithIndex{p, index ->
println index +”. “ + p.name
}
list.reverseEach { println it.name }
List Methods
•
size() - Get size of list
•
reverse() - reverses the order of list elements
•
contains(value) – Find if list contains specified value
•
sum(closure) - Sum all the elements of the list
•
min(closure) – Get min value of list
•
max(closure) – Get max value of list
•
flatten() - Make nested lists into a simple list
•
sort(closure) - Sort the list in ascending order
List Methods (Continued..)
.list1.intersect(list2) : returns a list that contains
elements that exist in both the
lists.
.list1.disjoint(list2) : Returns true/false indicating
whether lists are disjoint or not.
.every{condition} : checks whether every element of
the list satisfy the condition.
.any{condition} : checks whether any of the
element of the satisfy the
condition.
Sets
A Set cares about uniqueness - it doesn't allow duplicates
It can be considered as a list with restrictions, and is often
constructed from a list.
Set set = [1,3,3,4] as Set
([1,3,4])
No Ordering; element positions do not matter
Sets
Most methods available to lists, besides those that don't make
sense for unordered items, are available to sets.
Like - getAt, putAt, reverse
Ranges
Ranges allow you to create a list of sequential values.
These can be used as Lists since Range extends java.util.List.
Generally used for looping, switch, lists etc
Ranges defined with the “..” notation are inclusive (that is the list
contains the from and to value).
Ranges defined with the “..<” notation are exclusive, they include
the first value but not the last value.
Ranges
Range range = 1..10
range = -10..<10
range = '#'..'~'
Methods
range.from – Get the lower limit of range
range.to – Get upper limit of range
range.contains(value) – Does range contain value?
Maps
A Map cares about unique identifiers.
Each key can map to at most one value. Keys and values can be
of any type, and mixed together.
Initializing a Map :
def map = [:] ,
Map map = new HashMap()
Map<keyType, ValueType> map = [:]
Map<keyType, ValueType> map = new HashMap()
e.g. Map m = [1:'a', 2:'b', (true):'p', (false):'q', null:'z' ]
Maps
Adding an element:
map.put(key, value)
map.putAll(Map)
map.key = value
map[key] = value
Fetching elements:
map[key] / map.get(key) / map.key
Maps
Removing elements:
map.remove(key) : Remove key value pair associated with a
particular key
Adding Two Maps:
Map map3 = map1 + map2
Map.getClass()
Maps
Operations on keys:
map.containsKey(key)
map.keySet()
Operations on values:
map.containsValue(value)
map.values()
Maps
map.find { } - Find first occurence of element being searched
map.findAll { } - Return map of all occurences of element being
searched
map.each { } - Perform action with all elements
map.eachWithIndex {key,value->
println key + “. “ + value
}
More Map Methods...
isEmpty() - Is map empty?
toMapString() - Return map as a string
Some more List methods
groupBy{condition} - We can group a list into a map using some
criteria.
References
http://groovy.codehaus.org/Collections
http://groovy.codehaus.org/groovy-jdk/java/util/List.html
http://groovy.codehaus.org/api/groovy/lang/Range.html
http://groovy.codehaus.org/JN1035-Maps
http://groovy.codehaus.org/JN1015-Collections (sets)

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Python List Comprehensions
Python List ComprehensionsPython List Comprehensions
Python List Comprehensions
 
Python list
Python listPython list
Python list
 
Unit 4 python -list methods
Unit 4   python -list methodsUnit 4   python -list methods
Unit 4 python -list methods
 
Python Workshop Part 2. LUG Maniapl
Python Workshop Part 2. LUG ManiaplPython Workshop Part 2. LUG Maniapl
Python Workshop Part 2. LUG Maniapl
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
 
F sharp lists & dictionary
F sharp   lists &  dictionaryF sharp   lists &  dictionary
F sharp lists & dictionary
 
Python Lecture 10
Python Lecture 10Python Lecture 10
Python Lecture 10
 
Groovy
GroovyGroovy
Groovy
 
Pytho_tuples
Pytho_tuplesPytho_tuples
Pytho_tuples
 
Python Lecture 11
Python Lecture 11Python Lecture 11
Python Lecture 11
 
Data type list_methods_in_python
Data type list_methods_in_pythonData type list_methods_in_python
Data type list_methods_in_python
 
Dictionaries and Sets in Python
Dictionaries and Sets in PythonDictionaries and Sets in Python
Dictionaries and Sets in Python
 
Python :variable types
Python :variable typesPython :variable types
Python :variable types
 
List,tuple,dictionary
List,tuple,dictionaryList,tuple,dictionary
List,tuple,dictionary
 
Python dictionary
Python   dictionaryPython   dictionary
Python dictionary
 
Hashing and separate chain
Hashing and separate chainHashing and separate chain
Hashing and separate chain
 
Chapter 20 generic collections
Chapter 20   generic collectionsChapter 20   generic collections
Chapter 20 generic collections
 
Dictionaries
DictionariesDictionaries
Dictionaries
 
Python set
Python setPython set
Python set
 
Pytho lists
Pytho listsPytho lists
Pytho lists
 

Andere mochten auch

Andere mochten auch (20)

Groovy intro
Groovy introGroovy intro
Groovy intro
 
Introduction to Grails
Introduction to GrailsIntroduction to Grails
Introduction to Grails
 
Meta Programming in Groovy
Meta Programming in GroovyMeta Programming in Groovy
Meta Programming in Groovy
 
Docker
DockerDocker
Docker
 
Bootcamp linux commands
Bootcamp linux commandsBootcamp linux commands
Bootcamp linux commands
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
Unit test-using-spock in Grails
Unit test-using-spock in GrailsUnit test-using-spock in Grails
Unit test-using-spock in Grails
 
Java reflection
Java reflectionJava reflection
Java reflection
 
Actors model in gpars
Actors model in gparsActors model in gpars
Actors model in gpars
 
MetaProgramming with Groovy
MetaProgramming with GroovyMetaProgramming with Groovy
MetaProgramming with Groovy
 
Grails services
Grails servicesGrails services
Grails services
 
Grails Controllers
Grails ControllersGrails Controllers
Grails Controllers
 
Groovy DSL
Groovy DSLGroovy DSL
Groovy DSL
 
Grails with swagger
Grails with swaggerGrails with swagger
Grails with swagger
 
Grails domain classes
Grails domain classesGrails domain classes
Grails domain classes
 
Command objects
Command objectsCommand objects
Command objects
 
Jmh
JmhJmh
Jmh
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Reactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJavaReactive java - Reactive Programming + RxJava
Reactive java - Reactive Programming + RxJava
 
Introduction to thymeleaf
Introduction to thymeleafIntroduction to thymeleaf
Introduction to thymeleaf
 

Ähnlich wie Groovy

11 Introduction to lists.pptx
11 Introduction to lists.pptx11 Introduction to lists.pptx
11 Introduction to lists.pptx
ssuser8e50d8
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdf
MCCMOTOR
 
RANDOMISATION-NUMERICAL METHODS FOR ENGINEERING.pptx
RANDOMISATION-NUMERICAL METHODS  FOR ENGINEERING.pptxRANDOMISATION-NUMERICAL METHODS  FOR ENGINEERING.pptx
RANDOMISATION-NUMERICAL METHODS FOR ENGINEERING.pptx
Out Cast
 
beginners_python_cheat_sheet_pcc_all (1).pdf
beginners_python_cheat_sheet_pcc_all (1).pdfbeginners_python_cheat_sheet_pcc_all (1).pdf
beginners_python_cheat_sheet_pcc_all (1).pdf
ElNew2
 

Ähnlich wie Groovy (20)

List Data Structure.docx
List Data Structure.docxList Data Structure.docx
List Data Structure.docx
 
11 Introduction to lists.pptx
11 Introduction to lists.pptx11 Introduction to lists.pptx
11 Introduction to lists.pptx
 
Module-2.pptx
Module-2.pptxModule-2.pptx
Module-2.pptx
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdf
 
RANDOMISATION-NUMERICAL METHODS FOR ENGINEERING.pptx
RANDOMISATION-NUMERICAL METHODS  FOR ENGINEERING.pptxRANDOMISATION-NUMERICAL METHODS  FOR ENGINEERING.pptx
RANDOMISATION-NUMERICAL METHODS FOR ENGINEERING.pptx
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
Chapter 15 Lists
Chapter 15 ListsChapter 15 Lists
Chapter 15 Lists
 
Data Structure
Data StructureData Structure
Data Structure
 
Data structures: linear lists
Data structures: linear listsData structures: linear lists
Data structures: linear lists
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge
 
1. python
1. python1. python
1. python
 
Python cheatsheet for beginners
Python cheatsheet for beginnersPython cheatsheet for beginners
Python cheatsheet for beginners
 
Python programming Part -6
Python programming Part -6Python programming Part -6
Python programming Part -6
 
2. Python Cheat Sheet.pdf
2. Python Cheat Sheet.pdf2. Python Cheat Sheet.pdf
2. Python Cheat Sheet.pdf
 
python cheat sheat, Data science, Machine learning
python cheat sheat, Data science, Machine learningpython cheat sheat, Data science, Machine learning
python cheat sheat, Data science, Machine learning
 
Beginner's Python Cheat Sheet
Beginner's Python Cheat SheetBeginner's Python Cheat Sheet
Beginner's Python Cheat Sheet
 
beginners_python_cheat_sheet_pcc_all (1).pdf
beginners_python_cheat_sheet_pcc_all (1).pdfbeginners_python_cheat_sheet_pcc_all (1).pdf
beginners_python_cheat_sheet_pcc_all (1).pdf
 
DSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notesDSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notes
 
GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
Python lists &amp; sets
Python lists &amp; setsPython lists &amp; sets
Python lists &amp; sets
 

Mehr von NexThoughts Technologies

Mehr von NexThoughts Technologies (20)

Alexa skill
Alexa skillAlexa skill
Alexa skill
 
GraalVM
GraalVMGraalVM
GraalVM
 
Docker & kubernetes
Docker & kubernetesDocker & kubernetes
Docker & kubernetes
 
Apache commons
Apache commonsApache commons
Apache commons
 
HazelCast
HazelCastHazelCast
HazelCast
 
MySQL Pro
MySQL ProMySQL Pro
MySQL Pro
 
Microservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & ReduxMicroservice Architecture using Spring Boot with React & Redux
Microservice Architecture using Spring Boot with React & Redux
 
Swagger
SwaggerSwagger
Swagger
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Arango DB
Arango DBArango DB
Arango DB
 
Jython
JythonJython
Jython
 
Introduction to TypeScript
Introduction to TypeScriptIntroduction to TypeScript
Introduction to TypeScript
 
Smart Contract samples
Smart Contract samplesSmart Contract samples
Smart Contract samples
 
My Doc of geth
My Doc of gethMy Doc of geth
My Doc of geth
 
Geth important commands
Geth important commandsGeth important commands
Geth important commands
 
Ethereum genesis
Ethereum genesisEthereum genesis
Ethereum genesis
 
Ethereum
EthereumEthereum
Ethereum
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
An Introduction to Redux
An Introduction to ReduxAn Introduction to Redux
An Introduction to Redux
 
Google authentication
Google authenticationGoogle authentication
Google authentication
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Groovy

  • 3. Prerequisites l Knowledge of Java collections. l Basic working of groovy. l Working knowledge of Closure.
  • 4. Groovy Collections  Data structure that helps in dealing with a number of objects.  A wide variety of methods available for easy manipulation.
  • 5.
  • 6. Lists  A list cares about the index  Elements are assigned indices on the basis of how they are added  Has methods related to the index  Index starts from 0 Creating list //create empty list with ech element of type 'def' List list = [ ] //create empty list with elements of type 'type' List<type> list = [ ] List<type> list = new ArrayList()
  • 7. Lists Adding an element list.add(“element1”) list << “element1” list += “element1” list.push(element) List firstList = [1,2,3,4,5] List secondList = [“element2”] List thirdList = firstList + secondList println thirdList // [1,2,3,4,5,”element2”] fourthlist = thirdlist - firstlist println fourthlist // [“element2”]
  • 8. Lists Fetching elements: list[i] – Get ith element in list starting from 0 list.get(0) – Get first element in list list.getAt(0) – Get first element in list list.first() - Get first element of list list.head() - Get the head of list list.last() - Get last element of list list.tail() - Get all elements except first list.getAt(1..10) – Get elements from index 1 to 10 (includes index 10) list.subList(1, 10) - Get elements at index 1 to 10 (index 10 excluded)
  • 9. Lists Removing duplicates from a List : list.unique() // Alters original list list as Set Deleting an element from a List : (All of them alter original list) list.remove(idx) list.pop() list.removeAll(collection)
  • 10. Lists Convert String into List: “Hi” as List / “Hi”.toList() string.tokenize('_') : Splits the string into a list with argument used as delimiter. string.split('_') : Same as tokenize but can also accept regular expressions as delimiters Convert List into String: list.join(',')
  • 11. Lists Operations on each element of list: println list*.name // Use of spread operator list.collect { it.multiply(2) } // what if 'it' refers to string? list.find { it.name==”abc” } // returns one object list.findAll { it.name==”abc” } // returns list list.each { println it.name } list.eachWithIndex{p, index -> println index +”. “ + p.name } list.reverseEach { println it.name }
  • 12. List Methods • size() - Get size of list • reverse() - reverses the order of list elements • contains(value) – Find if list contains specified value • sum(closure) - Sum all the elements of the list • min(closure) – Get min value of list • max(closure) – Get max value of list • flatten() - Make nested lists into a simple list • sort(closure) - Sort the list in ascending order
  • 13. List Methods (Continued..) .list1.intersect(list2) : returns a list that contains elements that exist in both the lists. .list1.disjoint(list2) : Returns true/false indicating whether lists are disjoint or not. .every{condition} : checks whether every element of the list satisfy the condition. .any{condition} : checks whether any of the element of the satisfy the condition.
  • 14. Sets A Set cares about uniqueness - it doesn't allow duplicates It can be considered as a list with restrictions, and is often constructed from a list. Set set = [1,3,3,4] as Set ([1,3,4]) No Ordering; element positions do not matter
  • 15. Sets Most methods available to lists, besides those that don't make sense for unordered items, are available to sets. Like - getAt, putAt, reverse
  • 16. Ranges Ranges allow you to create a list of sequential values. These can be used as Lists since Range extends java.util.List. Generally used for looping, switch, lists etc Ranges defined with the “..” notation are inclusive (that is the list contains the from and to value). Ranges defined with the “..<” notation are exclusive, they include the first value but not the last value.
  • 17. Ranges Range range = 1..10 range = -10..<10 range = '#'..'~' Methods range.from – Get the lower limit of range range.to – Get upper limit of range range.contains(value) – Does range contain value?
  • 18. Maps A Map cares about unique identifiers. Each key can map to at most one value. Keys and values can be of any type, and mixed together. Initializing a Map : def map = [:] , Map map = new HashMap() Map<keyType, ValueType> map = [:] Map<keyType, ValueType> map = new HashMap() e.g. Map m = [1:'a', 2:'b', (true):'p', (false):'q', null:'z' ]
  • 19. Maps Adding an element: map.put(key, value) map.putAll(Map) map.key = value map[key] = value Fetching elements: map[key] / map.get(key) / map.key
  • 20. Maps Removing elements: map.remove(key) : Remove key value pair associated with a particular key Adding Two Maps: Map map3 = map1 + map2 Map.getClass()
  • 21. Maps Operations on keys: map.containsKey(key) map.keySet() Operations on values: map.containsValue(value) map.values()
  • 22. Maps map.find { } - Find first occurence of element being searched map.findAll { } - Return map of all occurences of element being searched map.each { } - Perform action with all elements map.eachWithIndex {key,value-> println key + “. “ + value }
  • 23. More Map Methods... isEmpty() - Is map empty? toMapString() - Return map as a string
  • 24. Some more List methods groupBy{condition} - We can group a list into a map using some criteria.