KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freemarker > template > EmptyMap


1 package freemarker.template;
2
3 import java.util.Collection JavaDoc;
4 import java.util.Collections JavaDoc;
5 import java.util.Map JavaDoc;
6 import java.util.Set JavaDoc;
7
8 public class EmptyMap implements Map JavaDoc, Cloneable JavaDoc {
9     public static final EmptyMap instance = new EmptyMap();
10     
11     public void clear() {
12         throw new UnsupportedOperationException JavaDoc("This Map is read-only.");
13     }
14     
15     public boolean containsKey(Object JavaDoc arg0) {
16         return false;
17     }
18     
19     public boolean containsValue(Object JavaDoc arg0) {
20         return false;
21     }
22     
23     public Set JavaDoc entrySet() {
24         return Collections.EMPTY_SET;
25     }
26     
27     public Object JavaDoc get(Object JavaDoc arg0) {
28         return null;
29     }
30     
31     public boolean isEmpty() {
32         return true;
33     }
34     
35     public Set JavaDoc keySet() {
36         return Collections.EMPTY_SET;
37     }
38     
39     public Object JavaDoc put(Object JavaDoc arg0, Object JavaDoc arg1) {
40         throw new UnsupportedOperationException JavaDoc("This Map is read-only.");
41     }
42     
43     public void putAll(Map JavaDoc arg0) {
44         throw new UnsupportedOperationException JavaDoc("This Map is read-only.");
45     }
46     
47     public Object JavaDoc remove(Object JavaDoc arg0) {
48         throw new UnsupportedOperationException JavaDoc("This Map is read-only.");
49     }
50     
51     public int size() {
52         return 0;
53     }
54     
55     public Collection JavaDoc values() {
56         return Collections.EMPTY_LIST;
57     }
58
59 }
60
Popular Tags