add clear() method
This commit is contained in:
@@ -18,7 +18,6 @@ public final class IntList implements Serializable, Cloneable {
|
||||
// TODO support Iterator
|
||||
// TODO add mod counts
|
||||
// TODO support sublists
|
||||
// TODO use sorted flag in indexOf
|
||||
// TODO add lastIndexOf
|
||||
// TODO remove bounds checks that are handled by java, e.g. negative indices
|
||||
// TODO clear
|
||||
@@ -518,6 +517,18 @@ public final class IntList implements Serializable, Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all elements from this list.
|
||||
* <p>
|
||||
* The implementation is equivalent to calling {@code remove(0, size())} and
|
||||
* {@code trim()}.
|
||||
*/
|
||||
public void clear() {
|
||||
data = EMPTY_ARRAY;
|
||||
size = 0;
|
||||
sorted = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sequential {@link IntStream} with this collection as its source.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user