Is There a java util method, or a short way to sort an Array of some type by an attribute of that type. I currently have an array of Choice
type objects where each have a getText()
method that returns the visual representation of the choice. I can make a long method that creates an array of the choices texts, sort them, get their ordered index and then order the choices by that index, but I surely think there is some kind of a shortcut.
Any Suggestions?