KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > rollback > ClassThree


1 /*
2  * ClassOne.java
3  *
4  * Created on 23 February 2004, 15:49
5  */

6
7 package org.netbeans.test.rollback;
8
9 import java.util.ArrayList JavaDoc;
10 import java.util.HashSet JavaDoc;
11 import java.util.Iterator JavaDoc;
12 import java.util.List JavaDoc;
13 import java.util.Set JavaDoc;
14
15
16 /**
17  *
18  * @author Dan
19  */

20 public class ClassThree {
21     
22     public static long numero;
23
24     public List JavaDoc list;
25     public Set JavaDoc set;
26     
27     static {
28         numero = 123;
29     }
30     
31     public ClassThree () {
32         list = new ArrayList JavaDoc();
33         set = new HashSet JavaDoc();
34     }
35     
36     public void addToList(Object JavaDoc obj) {
37         list.add(obj);
38         System.out.println(obj + " added");
39     }
40     
41     public void addToSet(Object JavaDoc obj) {
42         set.add(obj);
43         System.out.println(obj + " added");
44     }
45     
46     public void printItems() {
47         System.out.println("--------------");
48         for (Iterator JavaDoc iter = list.iterator(); iter.hasNext();) {
49             System.out.println(iter.next());
50         }
51         for (Iterator JavaDoc iter = set.iterator(); iter.hasNext();) {
52             System.out.println(iter.next());
53         }
54     }
55     
56 }
57
Popular Tags