MCPcopy Create free account
hub / github.com/davidgiven/luje / clear

Method clear

lib/java/util/ArrayList.java:256–268  ·  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

254 * @see #size
255 */
256 @Override
257 public void clear() {
258 if (size != 0) {
259 // REVIEW: Should we use Arrays.fill() instead of just
260 // allocating a new array? Should we use the same
261 // sized array?
262 Arrays.fill(array, firstIndex, firstIndex + size, null);
263 // REVIEW: Should the indexes point into the middle of the
264 // array rather than 0?
265 firstIndex = size = 0;
266 modCount++;
267 }
268 }
269
270 /**
271 * Returns a new {@code ArrayList} with the same elements, the same size and

Callers

nothing calls this directly

Calls 1

fillMethod · 0.95

Tested by

no test coverage detected