CopyOnWriteArrayList.java: Fix for empty list.
2010-04-27 Andrew Haley <aph@redhat.com> * java/util/concurrent/CopyOnWriteArrayList.java: Fix for empty list. From-SVN: r158790
This commit is contained in:
parent
b656968688
commit
126bac7bd6
|
@ -1,3 +1,8 @@
|
|||
2010-04-27 Andrew Haley <aph@redhat.com>
|
||||
|
||||
* java/util/concurrent/CopyOnWriteArrayList.java: Fix for empty
|
||||
list.
|
||||
|
||||
2010-04-27 Andrew Haley <aph@redhat.com>
|
||||
|
||||
* gnu/javax/print/ipp/IppResponse.java (parseAttributes): Handle
|
||||
|
|
|
@ -452,7 +452,12 @@ public class CopyOnWriteArrayList<E>
|
|||
public synchronized boolean remove(Object element)
|
||||
{
|
||||
E[] snapshot = this.data;
|
||||
E[] newData = (E[]) new Object[snapshot.length - 1];
|
||||
int len = snapshot.length;
|
||||
|
||||
if (len == 0)
|
||||
return false;
|
||||
|
||||
E[] newData = (E[]) new Object[len - 1];
|
||||
|
||||
// search the element to remove while filling the backup array
|
||||
// this way we can run this method in O(n)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue