×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2012
    Location
    Bangalore,India
    Posts
    26

    Hash table in j2me

    In my application i am filling one hash table using hashtablename.put values.Now i want this hashtable values to be displayed as it is in the order in hashtable.But now it showing collapsed order.Anybody please help me.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: Hash table in j2me

    It is not clear what kind of order you need, but Hashtable stores no meaningful order. You can use Hashtable.elements for getting what is inside, and if you really want to try something else, you can check if Hashtable.keys+Hashtable.get provides a different order (my guess would be that it does not). But none of them is going to be sorted alphabetically, or anything like that.

  3. #3
    Registered User
    Join Date
    Jul 2012
    Location
    Bangalore,India
    Posts
    26

    Re: Hash table in j2me

    Hi Wizard_hu_,

    thanks for your reply.one thing i am not clear my nash table are like

    htcity.put("723","chennai");
    htcity.put("724","madurai");
    htcity.put("725","salem");
    htcity.put("726","bangalore");
    htcity.put("727","namakkal");
    htcity.put("728","kovai");

    i want to get the value in same sequence without using key value is it possible.for eg chennai,madurai,salem....

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,684

    Re: Hash table in j2me

    You can read about the concept of hash tables on Wikipedia: http://en.wikipedia.org/wiki/Hashtable, Java uses Object.hashCode for calculating the hashes. (For the particular case of String-s (your key), the calculation is given in the documentation: http://java.sun.com/javame/reference...tml#hashCode())
    If you want to preserve order, you will need a Vector for example.

Similar Threads

  1. Hash table in symbian
    By prathi in forum Symbian
    Replies: 1
    Last Post: 2010-12-29, 06:33
  2. hash map or hash table in S60 3rd edition
    By mailtomakwana in forum Symbian
    Replies: 6
    Last Post: 2010-03-06, 20:53
  3. Hash table or map like data structure
    By gpalvia in forum Symbian
    Replies: 1
    Last Post: 2009-01-12, 10:10
  4. help: about glib hash table
    By wwxxdd1982 in forum Open C/C++
    Replies: 5
    Last Post: 2008-10-20, 09:50
  5. hash table in symbian???
    By harish13_ks in forum Symbian
    Replies: 9
    Last Post: 2007-05-26, 17:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×