Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: iteration blues Date: Fri, 04 Nov 2011 21:06:10 -0400 Organization: A noiseless patient Spider Lines: 31 Message-ID: References: <9hhpttFi6sU1@mid.individual.net> <9866683.514.1320428761383.JavaMail.geo-discussion-forums@yqmj32> <9hj8t5FoulU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 5 Nov 2011 01:06:13 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="HSlJAUb3pGXi3i7ZL/HoAw"; logging-data="2254"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192PP3ZaufMVrGYmk9XEkzw" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 In-Reply-To: <9hj8t5FoulU1@mid.individual.net> Cancel-Lock: sha1:Xx7Mf70CQUZKRQ1vlRs8IH8PIpA= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9550 On 11/4/2011 6:55 PM, Robert Klemme wrote: > On 04.11.2011 18:46, Lew wrote: >> Robert Klemme wrote: >>> I'm surprised nobody seems to mention Iterator.remove(). >> >> You must have missed: >>>> If your algorithm is (pseudocoded): >>>> >>>> for each item in collection process item delete item from >>>> collection >>>> >>>> you will need the iterator. >> >> All right, yeah, it *did* require that one be at least minimally >> familiar with 'java.util.Iterator' to understand exactly why "you >> will need the iterator", but every Java programmer from beginner >> onward surely is aware of 'Iterator#remove()', right? Surely no one >> calling themselves a Java programmer could be ignorant of such a >> basic, fundamental, early concept in Java? Could they? > > Well... Judging from my experience Iterator.remove() seems to be less > known than the other methods of that interface[...] True. Java's designers ought to have known better than to bloat an interface with *three* methods. That's at least one too many for today's programmers to grasp. Maybe two too many, or even more. -- Eric Sosman esosman@ieee-dot-org.invalid