List of utility methods to do Collection Clear
AnyCollection | cleanup(AnyCollection collection) Cleanups the collection by removing all null entries Iterator<?> iterator = collection.iterator(); while (iterator.hasNext()) { if (iterator.next() == null) { iterator.remove(); return collection; |
void | clear(Collection> collection) A null-safe way to clear a collection that might not be initialized if (collection != null)
collection.clear();
|
Collection | clear(Collection Removes all elements from the given collection. if (collection != null) { collection.clear(); return collection; |
void | clear(Collection clear if (collection != null) {
collection.clear();
|
void | clear(final Collection> collection) clear if (isNotEmpty(collection)) {
collection.clear();
|
void | clearAndAddAll(final Collection super E> where, final Collection extends E> fromWhere) clear And Add All if (where == fromWhere) { return; where.clear(); if (!isEmpty(fromWhere)) { where.addAll(fromWhere); |
void | clearCollection(Collection collection) clear Collection if (collection != null) {
collection.clear();
|