* java/util/concurrent/CopyOnWriteArrayList.java: Fix for empty
list.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158790
138bc75d-0d04-0410-961f-
82ee72b054a4
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
IppValueTag.UNKNOWN.
* gnu/javax/print/ipp/IppRequest.java (writeOperationAttributes):
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)