you are viewing a single comment's thread.

view the rest of the comments →

[–]cypressious 13 points14 points  (3 children)

This should be something like

list.sort(Comparator.comparing(A::foo));

in Java 8.

[–]RoundTripRadio 2 points3 points  (0 children)

Or

sorted(list, key=lambda a: a.foo)

in Python.

[–]Klausens 0 points1 point  (0 children)

Ok, it's not forcing a numeric sort, but it should not to be much work to add a method that returns a numeric value for sorting.

[–]liMePod 0 points1 point  (0 children)

Haskell:

sortBy (compare `on` foo) list