Told you, we love sharing!
I had a list of Strings and wanted to sort them but pay special attention to null values. See the default sorting in demonstration : [groovy] List<String> animals=["Monkey", null, "Ape", null, "Tiger", "Lion"] println animals.sort() // [null, null, Ape, Lion, Monkey, Tiger] println animals.sort().reverse() // [Tiger, Monkey, Lion, Ape, null, null] [/groovy] You can see […]