Removes the element at the specified position in this List.
Syntax
Object remove(int index)
Parameters
Index – Index at which the value needs to be removed.
Return Value
The removed value.
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.remove(2)); println(lst); } }
When we run the above program, we will get the following result −
13 [11, 12, 14]
Previous Page:-Click Here