Collection: Vider une ArrayList

Author:

 list, list, arrayList, collection, collection, arrayList, java
{filelink=4849}


import java.util.ArrayList;

public class Ex_ArrayL
 {

  public static void main(String[] args)
  {

    ArrayList arrayList = new ArrayList();

    arrayList.add("A");
    arrayList.add("B");
    arrayList.add("C");

    System.out.println("Contenu Avant: "+arrayList); // [A, B, C]

    // Vider le ArrayList
    arrayList.clear();

    System.out.println("Contenu Après: "+arrayList); // []

  }

}

Leave a Reply

Your email address will not be published. Required fields are marked *