Java-source: Parcourir et afficher le contenu de LinkedHashSet

Author:

Java-source: Parcourir et afficher le contenu de LinkedHashSet
Download

/***** Code de MesExemples.com *******/
import java.util.LinkedHashSet;
 
 class ParcourirLinkedHashSet
 {
 
public static void main(String[] args) {
 
//créer un objet LinkedHashSet et ajouter des valeurs
LinkedHashSet lhashSet = new LinkedHashSet();
System.out.println ("Taille initiale: "+lhashSet.size());
lhashSet.add("A");
lhashSet.add("B");
lhashSet.add("C");
 
 
Iterator itr = lhashSet.iterator(); 
System.out.println("LinkedHashSet contient : ");
while(itr.hasNext())
System.out.println(itr.next());
 
}
}

Cet article Java-source: Parcourir et afficher le contenu de LinkedHashSet est apparu en premier sur .