HashSet: Colección que no permite valores repetidos, si se intenta añadir uno repetido el método "add" retorna falso:
HashSeths = new HashSet (); hs.add(1); System.out.println(hs.add(3)); //retorna true , añadido éxitosamente. System.out.println(hs.add(3)); //retorna false, no se añadió el objeto. hs.add(1);//
http://www.coderanch.com/t/503961/java/java/Adding-duplicate-values-HashSet
0 comentarios:
Publicar un comentario