File: MyClass6.java

package info (click to toggle)
libjibx-java 1.0.1-2
  • links: PTS
  • area: contrib
  • in suites: lenny
  • size: 15,748 kB
  • ctags: 10,069
  • sloc: java: 29,151; xml: 7,963; makefile: 14
file content (43 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

package simple;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

class MyClass6
{
    private final List ints = new ArrayList();
    private final List strings = new ArrayList();
    private byte a;
    private boolean b;
    
    public static ArrayList createList() {
        throw new IllegalStateException
            ("Factory method should never be called");
    }
    
    protected void setInts(final List list) {
        if (list != ints) {
            throw new IllegalStateException
                ("Set method called with different list object");
        }
    }
    
    private boolean isPresent() {
        return ints.size() > 0;
    }
    
    private Iterator intsIterator() {
        return ints.iterator();
    }
    
    private void addInt(Object o) {
        ints.add((Integer)o);
    }
    
    private void addString(Object o) {
        strings.add((String)o);
    }
}