1 6 7 package org.netbeans.test.rollback; 8 9 import java.util.ArrayList ; 10 import java.util.HashSet ; 11 import java.util.Iterator ; 12 import java.util.List ; 13 import java.util.Set ; 14 15 16 20 public class ClassThree { 21 22 public static long numero; 23 24 public List list; 25 public Set set; 26 27 static { 28 numero = 123; 29 } 30 31 public ClassThree () { 32 list = new ArrayList (); 33 set = new HashSet (); 34 } 35 36 public void addToList(Object obj) { 37 list.add(obj); 38 System.out.println(obj + " added"); 39 } 40 41 public void addToSet(Object obj) { 42 set.add(obj); 43 System.out.println(obj + " added"); 44 } 45 46 public void printItems() { 47 System.out.println("--------------"); 48 for (Iterator iter = list.iterator(); iter.hasNext();) { 49 System.out.println(iter.next()); 50 } 51 for (Iterator iter = set.iterator(); iter.hasNext();) { 52 System.out.println(iter.next()); 53 } 54 } 55 56 } 57 | Popular Tags |