#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    India
    Posts
    3
    Rep Power
    0

    Problem with Hashtable values


    Hi,
    I am getting problem with hashtable.
    I am putting values dynamically into the hashtable and then after i am redefining my value. Means i am putting vector in to the hashtable for every different key. I am clearing my vector after every entry into the hashtable.
    Whenever i am retreiving the data my hashtable retrieves values. But the value in hashtable gives problems and gives zero size vector..

    How can i use my hashtable and vector.


    Example code :

    Hashtable indhash=new Hashtable();
    Vector indvec1=new Vector();
    String st1=null;
    for(int i=0;i<indstr.length;i++)
    {
    if(st1==null)
    st1=indstr[i][0];
    if(!st1.equals(indstr[i][0]))
    {
    indhash.put(st1,indvec1);
    st1=indstr[i][0];
    indvec1.clear();
    indvec1.addElement(indstr[i][1]);
    }
    else
    {
    indvec1.addElement(indstr[i][1]);
    }
    if(i==indstr.length-1)
    {
    indhash.put(indstr[i][0],indvec1);
    indvec1.clear();
    }
    }

    after this when retriving my hashtable gives zero length vector from hastable.
    Please help Me.

    Its'
    Murthy
  2. #2
  3. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,184
    Rep Power
    2220
    Is this C ?
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn

IMN logo majestic logo threadwatch logo seochat tools logo