[jira] Updated: (PIVOT-264) Concurrent modification check in ArrayList is too naive

2009-09-04 Thread Todd Volkert (JIRA)
[ https://issues.apache.org/jira/browse/PIVOT-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Todd Volkert updated PIVOT-264: --- Fix Version/s: (was: 1.3.1) 1.3 > Concurrent modification check in ArrayL

[jira] Resolved: (PIVOT-264) Concurrent modification check in ArrayList is too naive

2009-09-02 Thread Greg Brown (JIRA)
[ https://issues.apache.org/jira/browse/PIVOT-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Greg Brown resolved PIVOT-264. -- Resolution: Fixed > Concurrent modification check in ArrayList is too na

[jira] Created: (PIVOT-264) Concurrent modification check in ArrayList is too naive

2009-09-02 Thread Greg Brown (JIRA)
Concurrent modification check in ArrayList is too naive --- Key: PIVOT-264 URL: https://issues.apache.org/jira/browse/PIVOT-264 Project: Pivot Issue Type: Bug Components: core

Re: ArrayList

2009-09-01 Thread Sandro Martini
Great, now looks better. By

Re: ArrayList

2009-09-01 Thread Greg Brown
After looking at the code, I agree that it could have been written more cleanly. I have checked in an updated version that I think reads better. G On Tuesday, September 01, 2009, at 08:23AM, "Todd Volkert" wrote: >I think that sounds like an equitable solution :) > >On Tue, Sep 1, 2009 at 8:21

Re: ArrayList

2009-09-01 Thread Todd Volkert
I think that sounds like an equitable solution :) On Tue, Sep 1, 2009 at 8:21 AM, Sandro Martini wrote: > Hi to all, > so what do you think on keeping the tests inside the while as currently, > but instead of the empty block using only ";" I think it would be > better a { } block. > And maybe wit

Re: ArrayList

2009-09-01 Thread Sandro Martini
Hi to all, so what do you think on keeping the tests inside the while as currently, but instead of the empty block using only ";" I think it would be better a { } block. And maybe with clarifying comment inside like // empty block At least to avoid warnings from many tools ... Sandro

Re: ArrayList

2009-09-01 Thread Martijn Dashorst
I'm not a committer, so take my advice any way you like. /me ascends high horse An empty loop is 99.9% of the time a coding error. There's a reason why pmc, checkstyle and findbugs trigger on this type of programming. In my opinion, writing code that clearly shows intent is a pre, and code that d

Re: ArrayList

2009-09-01 Thread Greg Brown
It's legal and technically correct Java, but I prefer to write such things like this: while (iterator.hasNext()) {} to make it obvious that it's an empty block. If others feel strongly that this makes the intent more explicit, I will change it. What about cases like this: if (...) {

Re: ArrayList

2009-09-01 Thread Greg Brown
I like it as-is. I find the other alternatives to be needlessly verbose. On Sep 1, 2009, at 6:54 AM, Sandro Martini wrote: Hi, while (iterator.hasNext()) {} while (iterator.hasNext()) { /* intentionally left blank */ } I think moving to one of these blocks formats could be more reada

Re: ArrayList

2009-09-01 Thread Todd Volkert
Better :) However, it occurs to me that we need to then check if one list is a subset of the other, so after the while loop, we would have: equal = (!iterator.hasNext() && !arrayListIterator.hasNext()); This makes the earlier maintenance of 'equal' seem odd to me. The existing implementatio

Re: ArrayList

2009-09-01 Thread Martijn Dashorst
Shaving off some lines :-) boolean equal = true; while (iterator.hasNext() && linkedListIterator.hasNext() && equal) { equal = iterator.next().equals(linkedListIterator.next()); } Martijn On Tue, Sep 1, 2009 at 12:47 PM, Todd Volkert wrote: > I personally don't have a problem with it, but if

Re: ArrayList

2009-09-01 Thread Sandro Martini
Hi, >>   while (iterator.hasNext()) {} > > while (iterator.hasNext()) { /* intentionally left blank */ } I think moving to one of these blocks formats could be more readable ... Sandro

Re: ArrayList

2009-09-01 Thread Todd Volkert
I personally don't have a problem with it, but if some find it hard to read, then here's the same thing re-phrased: #!{{{ boolean equal = true; while (iterator.hasNext() && linkedListIterator.hasNext()) { if (!iterator.next().equals(linkedListIterator.next())) { equal = false;

Re: ArrayList

2009-09-01 Thread Martijn Dashorst
On Tue, Sep 1, 2009 at 11:41 AM, Noel Grandin wrote: > > It's legal and technically correct Java, but I prefer to write such > things like this: > >   while (iterator.hasNext()) {} > > to make it obvious that it's an empty block. > And even better: while (iterator.hasNext()) { /* intentionally le

Re: ArrayList

2009-09-01 Thread Sandro Martini
Hi Noel, i agree with you, more clear,adn to avoid warnings ... what other say ? Bye

Re: ArrayList

2009-09-01 Thread Noel Grandin
It's legal and technically correct Java, but I prefer to write such things like this: while (iterator.hasNext()) {} to make it obvious that it's an empty block. Sandro Martini wrote: > Hi, in ArrayList I've just found a warning ... in equals() > >

Re: ArrayList

2009-09-01 Thread Sandro Martini
Hi, also in equals() in LinkedList: while (iterator.hasNext() && linkedListIterator.hasNext() && iterator.next().equals(linkedListIterator.next())); => the same thing ... equals = (!iterator.hasNext() && !linkedListIterator.

ArrayList

2009-09-01 Thread Sandro Martini
Hi, in ArrayList I've just found a warning ... in equals() while (iterator.hasNext() && arrayListIterator.hasNext() && iterator.next().equals(arrayListIterator.next())); => there is a ; after the while ... is it righ