Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: iteration blues Date: Fri, 04 Nov 2011 23:55:27 +0100 Lines: 33 Message-ID: <9hj8t5FoulU1@mid.individual.net> References: <9hhpttFi6sU1@mid.individual.net> <9866683.514.1320428761383.JavaMail.geo-discussion-forums@yqmj32> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 0uBRaU6fHGKxLewza2O0ew4FOEpU9605lQL1MOFQ54dTS8WsU= Cancel-Lock: sha1:Opdh3SLZaEnOfRBaFiRLmIQeXkI= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 In-Reply-To: <9866683.514.1320428761383.JavaMail.geo-discussion-forums@yqmj32> Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9539 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 - although not as much as methods (and even the existence) of ListIterator. :-) I would consider this pretty basic knowledge as you did - probably in the same area as the ternary operator - but empiricism often proves our assumptions wrong. :-) Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/