Lines Matching defs:key

67      * Sets the specified key/value in the underlying <code>map</code> field.
72 * @return Previous value for the specified key. Returns null if key was previously
89 * if toMerge map is null or if some key in the map is null.
91 * if some key in the map is an empty String.
98 String key = entry.getKey();
99 checkKey(key);
100 put(key, entry.getValue());
111 * key. More formally, returns <tt>true</tt> if and only if
112 * this map contains a mapping for a key <tt>k</tt> such that
113 * <tt>(key==null ? k==null : key.equals(k))</tt>. (There can be
116 * @param key key whose presence in this map is to be tested.
118 * key.
120 * @throws NullPointerException if key is null
121 * @throws ClassCastException if key is not String
122 * @throws IllegalArgumentException if key is empty String
124 public boolean containsKey(Object key) {
125 checkKey(key);
126 return map.containsKey(key);
140 * Returns the value to which this map maps the specified key. Returns
141 * <tt>null</tt> if the map contains no mapping for this key. A return
143 * map contains no mapping for the key; it's also possible that the map
144 * explicitly maps the key to <tt>null</tt>. The <tt>containsKey</tt>
147 * <p>More formally, if this map contains a mapping from a key
148 * <tt>k</tt> to a value <tt>v</tt> such that <tt>(key==null ? k==null :
149 * key.equals(k))</tt>, then this method returns <tt>v</tt>; otherwise
152 * @param key key whose associated value is to be returned.
153 * @return the value to which this map maps the specified key, or
154 * <tt>null</tt> if the map contains no mapping for this key.
156 * @throws NullPointerException if key is null
157 * @throws ClassCastException if key is not String
158 * @throws IllegalArgumentException if key is empty String
160 public Object get(Object key) {
161 checkKey(key);
162 return map.get(key);
176 * Removes the mapping for this key from this map if it is present
178 * from key <tt>k</tt> to value <tt>v</tt> such that
179 * <code>(key==null ? k==null : key.equals(k))</code>, that mapping
182 * <p>Returns the value to which the map previously associated the key, or
183 * <tt>null</tt> if the map contained no mapping for this key. (A
185 * associated <tt>null</tt> with the specified key if the implementation
187 * the specified key once the call returns.
189 * @param key key whose mapping is to be removed from the map.
190 * @return previous value associated with specified key, or <tt>null</tt>
191 * if there was no mapping for key.
193 * @throws NullPointerException if key is null
194 * @throws ClassCastException if key is not String
195 * @throws IllegalArgumentException if key is empty String
197 public Object remove(Object key) {
198 checkKey(key);
199 return map.remove(key);
212 private void checkKey(Object key) {
213 if (key == null) {
214 throw new NullPointerException("key can not be null");
216 if (!(key instanceof String)) {
217 throw new ClassCastException("key should be a String");
219 if (key.equals("")) {
220 throw new IllegalArgumentException("key can not be empty");