🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7371

HashMap.keySet().iterator() and threads

#7371
From: Petar Banicevic
Date: Mon, 25 Jun 2001 09:06
11 lines
1233 bytes
This is in run() method in Thread:

        while (localStack.keySet().iterator().hasNext()) {
          String fileName=(String)localStack.keySet().iterator().next();
        }

Now, what would happen if somebody else, out of this thread, adds/removes a
few lines in localStack while this loop is running. LocalStack is HashMap.

Thanks for helping !
Peter
Technical Details
Message-ID: <3b36ff40_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.online.be!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,2ab9a045bec56d80,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-25 02:08:41 PST
From: "Petar Banicevic" <petar_b@usa.net>
Newsgroups: borland.public.jbuilder.java.language
Subject: HashMap.keySet().iterator() and threads
Date: Mon, 25 Jun 2001 11:06:58 +0200
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 12.98.142.222
Message-ID: <3b36ff40_1@dnews>
X-Trace: dnews 993460032 12.98.142.222 (25 Jun 2001 02:07:12 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.online.be!newsfeeds.belnet.be!news.belnet.be!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews