Example
Eradicate all items from a list.
import java.util.LinkedList;
public class Main {
public static void main(String[] args) {
LinkedList<String> cars = new LinkedList<String>();
cars.add("Volvo");
cars.add("BMW");
cars.add("Ford");
cars.add("Mazda");
cars.clear();
System.out.println(cars); } }
|
Definition and Usage
The clear() method eradicates all items from the list.
Syntax