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