How to count mobile objects?


I would like to know how to count mobile objects. For example: I have a list, and I want to count the number of items within the list.

Thank you very much!

For further actions to list, you should refer to Groovy Documentations here. They have all the information you need to do with the list.

Hi there,

Counting the number of items within a list is easy:


=> Count all items in the list


=> Count specific items in the list

def list = [``0``, 1``, 2``, 1``, 1``, 3``, 2``, 0``, 1``]

assert 9 == list.``size``()
assert 2 == list.``count``(``0``)
assert 4 == list.``count``(``1``)
assert 2 == list.``count``(``2``)
assert 1 == list.``count``(``3``)