11 Replies Latest reply on Sep 22, 2006 1:06 PM by 791266

    Sharing a data Structure(HashMap) across multiple threads

      Hi, I would like to share a data structure (e.g. HashMap) across multiple threads. Each thread will be adding an entry to the HashMap. A part of the code is:
      HashMap info = new HashMap();
      File[] contents = mainDir.listFiles();
      for (int i = 0; i < contents.length; i++) {           
                          spawnThread st = new spawnThread(contents, info);
      Thread t = new Thread(st);

      How can I get it done properly?