Here you can find the source of clear(Collection> collection)
Parameter | Description |
---|---|
collection | The collection to clear |
public static void clear(Collection<?> collection)
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { /**//from w w w . j av a2 s. co m * A null-safe way to clear a collection that might not be initialized * @param collection The collection to clear */ public static void clear(Collection<?> collection) { if (collection != null) collection.clear(); } }