I am using this line here to sort a list based on the object\'s name.
g.V.sort{it.name}
How do I sort it based on \"name\" if it exists, if not
You can sorts the Collection using a Comparator.
Comparator
g.V.sort { a, b -> a.name <=> b.name ?: a.title <=> b.title }