Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,845 questions

51,766 answers

573 users

How to get all values for specific key from map in Groovy

1 Answer

0 votes
def map = [
	  1: [lang:"Groovy", isbn: 654, book: "Groovy Pro"],
	  2: [lang:"Java", isbn: 981, book: "Java Pro"],
	  3: [lang:"C++", isbn: 236, book: "C++ Pro"],
	  4: [lang:"Python", isbn: 708, book: "Python Pro"]]
 
def langs = map.collect{entry -> entry.value.lang}

println langs

println langs.get(0)  

  
  
/*
run:
  
[Groovy, Java, C++, Python]
Groovy
  
*/

 



answered Oct 5, 2020 by avibootz

Related questions

1 answer 245 views
4 answers 612 views
1 answer 218 views
2 answers 428 views
1 answer 223 views
223 views asked Oct 5, 2020 by avibootz
1 answer 252 views
...