Skip to content

Hash Table

Tapsya Suri

Asked May 29, 2008, 10:17 PM EDT1 answer
Share
LinkedInX

Hi All,

Can any body let me know if data in a hash table folows any order ie., asc or desc or it simply just follows the concept of LIFO.

thanks

Tapsya

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    Hashtables are unsorted collections and do not implement any sorting functionality. An alternative to get sorted list is to put the hashtable values into a collection that imlements sorting. We can use System.Collections.SortedList as well as ArrayList to get sorted values.


    ArrayList al = new ArrayList (hashtable.Values);
    al.Sort (myNameComparator);

    System.Collections.SortedList sl = new System.Collections.SortedList(h.Values);

    0