1
2
3
4
5
6
7
8
9
10
11
12public
13class NoOfElements extends Accumulate {
14
15
16
17
18
19 private
20 int result;
21
22
23
24 public
25 NoOfElements()
26 {
27 result = 0;
28 }
29
30
31
32 public
33 void process(Object element)
34 {
35 ++result;
36 }
37
38
39
40 public
41 Object getResult()
42 {
43
44 return
45 new Integer(result);
46 }
47}
48