• Post Reply Bookmark Topic Watch Topic
  • New Topic

sort keyset of Hashtable

 
Stefan Nie�ner
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!

i'm using midp2.0 and i want to know if there is any possibility do sort the keys of a hashtable.
i know, that in j2se exists the collection.sort() - method, but i've nothing found for midp.

thanks in advance, stefan
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like there's nothing to do this directly in MIDP 2.0. Probably the easiest way to handle this is to write your own sort() implementation, and then use it to sort a Vector or array of the keys. There are many ways to implement a sort, of course - but a quick way might be to just look at the source code used by Arrays.sort(). It just calls a private mergeSort() method which is fairly simple to duplicate.
 
Maybe he went home and went to bed. And took this tiny ad with him:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!