Logo

Programming-Idioms

History of Idiom 117 > diff from v54 to v55

Edit summary for version 55 by programming-idioms.org:
New Groovy implementation by user [programming-idioms.org]

Version 54

2020-10-10, 21:20:45

Version 55

2020-10-14, 11:09:10

Idiom #117 Get list size

Set n to the number of elements of list x.

Idiom #117 Get list size

Set n to the number of elements of list x.

Variables
n,x
Variables
n,x
Extra Keywords
length
Extra Keywords
length
Code
def n = x.size()
Comments bubble
List inherits method size from Iterable
Doc URL
https://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/Iterable.html#size()
Demo URL
https://groovyconsole.appspot.com/script/5154182407389184