package tema3; import java.util.Iterator; import java.util.TreeSet; public class EjemploStrings { /** * @param args */ public static void main(String[] args) { String textoOriginal = "uno@hotmail.com;dos@gmail.com;tres@yahoo.es;" + "cuatro@gmail.com;cinco@yahoo.com;seis@hotmail.com"; TreeSet domains = new TreeSet(); String[] emails = textoOriginal.split(";"); for (int i=0;i iteraDomains = domains.iterator(); for(int i=1;iteraDomains.hasNext();i++){ String domainName = iteraDomains.next(); System.out.println(i + ": " + domainName); } } }