Groovy – values()

  • Post author:
  • Post category:Groovy
  • Post comments:0 Comments
values

Returns a collection view of the values contained in this Map.

Syntax

Collection values()

Parameters

None.

Return Value

Collection of values.

Example

Following is an example of the usage of this method −

class Example {
   static void main(String[] args) {
      def mp = ["TopicName" : "Maps", "TopicDescription" : "Methods in Maps"]
      println(mp.values()); 
   } 
} 

When we run the above program, we will get the following result −

[Maps, Methods in Maps]

Previous Page:-Click Here

Leave a Reply