问题
I have a file consisting of entries like Paula 100, Steve 150, Julian 200. I want to sort this.
Can I use the Collections framework in BlackBerry to sort file entries consisting of numbers and names? I can't find any sorting program for blackberry. So I am wondering if I can use Collections.sort()?
回答1:
There are sortable collections in the BlackBerry API that you can use. Search the JavaDocs for things like SimpleSortingVector and BigVector.
回答2:
Unfortunately, BlackBerry uses J2ME which doesn't include the Collections framework. However, you can still do sorting of Arrays using the Arrays class.
回答3:
Yes, you can use it. It's not specifically a Blackberry thing; it's just generic Java.
You may wish to use the version that takes a Comparator, and implement that interface so that it orders your list items in the way you wish to sort them.
来源:https://stackoverflow.com/questions/4069579/sorting-with-blackberry