If you have two objects, Obj1 and Obj2 of the same type (or implicitly castable types, for example integer num and real num) you can compare them and find out which one is greater BUT only if there is defined comparer for that type
Some types already have default comparers (5 > 2.71)
You can define you own comparer for any type of object (in c# component)
For example you can define comparer for Polyline which will analize position of polyline in space and decide which one of them is “greater”, or have defined comparer that will compare lenghts of curves …
If you are able to compare objects, you are able to sort them and group them as well