import java.util.*;
/*
* Création, modification et affichage d'un HashSet
*
**/
public class ExempleHashSet
{
public static void main (String[] args)
{
// Créer une HashSet avec une capacité initiale
Set s1 = new HashSet(8);
int hash = 0;
String str="abnghtpo";
for (char ch : str.toCharArray())
{
hash = hash * 31 + ch;
s1.add(hash);
}
// Afficher le contenu de HashSet
Iterator iter=s1.iterator();
while(iter.hasNext())
{
System.out.println (iter.next());
}
}
}