Groovy - values()


Advertisements

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]
groovy_maps.htm
Advertisements