PRO_gramer

com api hashset

Jun 29th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. import java.util.HashSet;
  2.  
  3. public class Teste {
  4. public static void main(String[] args){
  5.     HashSet conjunto = new HashSet();
  6.    
  7.     conjunto.add("a : Maçã");
  8.     conjunto.add("b : Laranja");
  9.     conjunto.add("c : Mamão");
  10. System.out.println(conjunto);
  11.    
  12. System.out.println(conjunto.size());
  13.  
  14. System.out.println(conjunto.iterator());
  15. System.out.println(conjunto.contains("d : manga"));
  16. System.out.println(conjunto.isEmpty());
  17.  
  18.    
  19.    
  20.    
  21.    
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment