Groovy – pop()

  • Post author:
  • Post category:Groovy
  • Post comments:1 Comment
last item

Removes the last item from this List.

Syntax

Object pop() 

Parameters

None

Return Value

The popped value from the list.

Example

Following is an example of the usage of this method −

class Example { 
   static void main(String[] args) { 
      def lst = [11, 12, 13, 14]; 

      println(lst.pop()); 
      println(lst); 
   } 
}

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

14 
[11, 12, 13]

Previous Page:-Click Here

This Post Has One Comment

Leave a Reply