/** * The returned array may contain <code>null</code> elements! * {@inheritDoc} */ public Object[] toArray(Object a[]) { if (a.length < size) { a = (Object[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size); } for (int i = 0; i < size; i++) { a[i] = elementData[i].get(); } if (a.length > size) { a[size] = null; } return a; }
/** * The returned array may contain <code>null</code> elements! * {@inheritDoc} */ public Object[] toArray(Object a[]) { if (a.length < size) { a = (Object[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size); } for (int i = 0; i < size; i++) { a[i] = elementData[i].get(); } if (a.length > size) { a[size] = null; } return a; }
/** * The returned array may contain <code>null</code> elements! * {@inheritDoc} */ public Object[] toArray(Object a[]) { if (a.length < size) { a = (Object[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size); } for (int i = 0; i < size; i++) { a[i] = elementData[i].get(); } if (a.length > size) { a[size] = null; } return a; }
/** * Removes the object <code>o</code> from this collection if it is present. * * @param o the object to remove. * @return <code>true</code> if this collection changed as a result of the * call. */ public boolean remove(Object o) { for (int i = 0; i < size; i++) { if (elementData[i].get() == o) { emptySlots.set(i); // overwrite entry with dummy ref elementData[i] = new WeakRef(null, i); return true; } } return false; }
/** * Removes the object <code>o</code> from this collection if it is present. * * @param o the object to remove. * @return <code>true</code> if this collection changed as a result of the * call. */ public boolean remove(Object o) { for (int i = 0; i < size; i++) { if (elementData[i].get() == o) { emptySlots.set(i); // overwrite entry with dummy ref elementData[i] = new WeakRef(null, i); return true; } } return false; }
/** * Removes the object <code>o</code> from this collection if it is present. * * @param o the object to remove. * @return <code>true</code> if this collection changed as a result of the * call. */ public boolean remove(Object o) { for (int i = 0; i < size; i++) { if (elementData[i].get() == o) { emptySlots.set(i); // overwrite entry with dummy ref elementData[i] = new WeakRef(null, i); return true; } } return false; }
/** * The returned array may contain <code>null</code> elements! * @inheritDoc */ public Object[] toArray(Object a[]) { if (a.length < size) { a = (Object[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size); } for (int i = 0; i < size; i++) { a[i] = elementData[i].get(); } if (a.length > size) { a[size] = null; } return a; }
/** * Removes the object <code>o</code> from this collection if it is present. * * @param o the object to remove. * @return <code>true</code> if this collection changed as a result of the * call. */ public boolean remove(Object o) { for (int i = 0; i < size; i++) { if (elementData[i].get() == o) { emptySlots.set(i); // overwrite entry with dummy ref elementData[i] = new WeakRef(null, i); return true; } } return false; }
/** * Returns <code>true</code> if this collection contains <code>o</code>. * * @param o element whose presence in this collection is to be tested. * @return <code>true</code> if this collection contains the specified * element */ public boolean contains(Object o) { for (int i = 0; i < size; i++) { if (elementData[i].get() == o) { return true; } } return false; }
/** * Returns <code>true</code> if this collection contains <code>o</code>. * * @param o element whose presence in this collection is to be tested. * @return <code>true</code> if this collection contains the specified * element */ public boolean contains(Object o) { for (int i = 0; i < size; i++) { if (elementData[i].get() == o) { return true; } } return false; }
/** * Returns <code>true</code> if this collection contains <code>o</code>. * * @param o element whose presence in this collection is to be tested. * @return <code>true</code> if this collection contains the specified * element */ public boolean contains(Object o) { for (int i = 0; i < size; i++) { if (elementData[i].get() == o) { return true; } } return false; }
/** * Returns <code>true</code> if this collection contains <code>o</code>. * * @param o element whose presence in this collection is to be tested. * @return <code>true</code> if this collection contains the specified * element */ public boolean contains(Object o) { for (int i = 0; i < size; i++) { if (elementData[i].get() == o) { return true; } } return false; }
/** * Returns an array containing all of the elements in this collection. The * returned array may contain <code>null</code> elements! * * @return an array containing all of the elements in this collection. */ public Object[] toArray() { Object[] result = new Object[size]; for (int i = 0; i < result.length; i++) { result[i] = elementData[i].get(); } return result; }
/** * Returns an array containing all of the elements in this collection. The * returned array may contain <code>null</code> elements! * * @return an array containing all of the elements in this collection. */ public Object[] toArray() { Object[] result = new Object[size]; for (int i = 0; i < result.length; i++) { result[i] = elementData[i].get(); } return result; }
/** * Returns an array containing all of the elements in this collection. The * returned array may contain <code>null</code> elements! * * @return an array containing all of the elements in this collection. */ public Object[] toArray() { Object[] result = new Object[size]; for (int i = 0; i < result.length; i++) { result[i] = elementData[i].get(); } return result; }
/** * Returns an array containing all of the elements in this collection. The * returned array may contain <code>null</code> elements! * * @return an array containing all of the elements in this collection. */ public Object[] toArray() { Object[] result = new Object[size]; for (int i = 0; i < result.length; i++) { result[i] = elementData[i].get(); } return result; }