MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / clear

Method clear

vm/JavaAPI/src/java/util/ArrayList.java:264–276  ·  view source on GitHub ↗

Removes all elements from this ArrayList, leaving it empty. @see #isEmpty @see #size

()

Source from the content-addressed store, hash-verified

262 * @see #size
263 */
264 @Override
265 public void clear() {
266 if (size != 0) {
267 // REVIEW: Should we use Arrays.fill() instead of just
268 // allocating a new array? Should we use the same
269 // sized array?
270 Arrays.fill(array, firstIndex, firstIndex + size, null);
271 // REVIEW: Should the indexes point into the middle of the
272 // array rather than 0?
273 firstIndex = size = 0;
274 modCount++;
275 }
276 }
277
278 /**
279 * Searches this {@code ArrayList} for the specified object.

Calls 1

fillMethod · 0.95