Hi Ulf, I'm sorry I didn't quite get your testcase. Will you please provide a jtreg style testcase with main method ?
I was thinking you were worried by the comment "// inherits from AbstractCollection.toArray()" and "map2", if that was the case, I would like to modify. On Fri, Mar 23, 2012 at 5:57 AM, Ulf Zibis <ulf.zi...@gmx.de> wrote: > Hi Sean, > > bad news ;-) ... > > Am 22.03.2012 08:28, schrieb Sean Chou: > >> Hi Ulf, >> >> I'm glad you agreed my suggestion. >> >> To all: >> Can this patch be committed as it has been reviewed by David Holmes >> and Mike Duigou, and Ulf also says agreed ? >> > > I agree with your implementation of AbstractCollection, but NOT with the > test. > For correct testing I suggest to use: > > /** > * > * @author Ulf Zibis > */ > public class TestCollection<E> extends AbstractCollection<E> { > > private E[] elements; > private int[] sizes; > private int nextSize; > > public TestCollection(E[] elements) { > this.elements = elements; > setConcurrentSizeCourse(null); > } > > void setConcurrentSizeCourse(int... sizes) { > this.sizes = sizes == null ? new int[]{elements.length} : sizes; > nextSize = 0; > } > > @Override > public int size() { > return sizes[nextSize == sizes.length-1 ? nextSize : nextSize++]; > } > > @Override > public Iterator<E> iterator() { > return new Iterator<>() { > > int pos = 0; > > public boolean hasNext() { > return pos < sizes[nextSize]; > } > > public E next() { > return elements[pos++]; > } > > public void remove() { > throw new UnsupportedOperationException(**"Not supported > yet."); > } > }; > } > } > > -Ulf > > -- Best Regards, Sean Chou