Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1.  
  2. public class IntSetImpl implements IntSet {
  3.  
  4. private List<Integer> conjunto; //lista de inteiros
  5.  
  6. IntSetImpl ( ) {
  7.  
  8. this.conjunto = new ArrayList <Integer>(); //crio nova lista de inteiros vazia
  9.  
  10. }
  11.  
  12. void insert ( int x ) {
  13. this.conjunto.add(x);
  14. }
  15. void insertAll ( int [ ] v ){
  16. int count = 0;
  17. while (count < v.size ) {
  18. insert(v[count]);
  19. count++;
  20. }
  21. }
  22.  
  23. void remove ( int x ) {
  24. this.conjunto.remove(x);
  25. }
  26.  
  27. boolean isIn ( int x ) {
  28. return this.conjunto.contains(x);
  29. }
  30.  
  31. int size ( ) {
  32. return this.conjunto.size();
  33. }
  34.  
  35. void forAll ( Visitor v ) {
  36. System.out.println("numero eh" conjunto );
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement