In this example we will show how to count the number of times an element appears within a list. For seed data in the first snippet we used common gridiron football sport names and populated a list from 1 to 10 for the second. In both snippets we will use list.count passing a groovy closure with a clause. You can consider the count a short cut to filtering and finding the size of an arraylist. A comparable example demonstrates how to count the frequency of string or numbers in arraylist using java.