public synchronized boolean containsKey(Object key) { return getIndex(key) >= 0; }
/** * Set a header value. * * @param key Key name. * @param value Value of the key or null to remove key. * @return the previous value to which the key was mapped, * or null if the key did not have a previous mapping. * * @exception IllegalArgumentException If a case-variant of the key is * already present. */ public synchronized Object set(Object key, Object value) { return set(key, value, false); }
return null; try { return (Dictionary) ManifestElement.parseBundleManifest(manifestStream, new Headers(10)); } catch (BundleException e) { } finally {
/** * Always throws UnsupportedOperationException. * * @param key header name. * @param value header value. * @throws UnsupportedOperationException */ public synchronized Object put(Object key, Object value) { if (readOnly) throw new UnsupportedOperationException(); return set(key, value, true); }
/** * Support case-insensitivity for keys. * * @param key name. */ public synchronized Object get(Object key) { int i = -1; if ((i = getIndex(key)) != -1) return values[i]; return null; }
/** * Create a Headers dictionary from a Dictionary. * * @param values The initial dictionary for this Headers object. * @exception IllegalArgumentException If a case-variant of the key is * in the dictionary parameter. */ public Headers(Dictionary values) { this(values.size()); /* initialize the headers and values */ Enumeration keys = values.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); set(key, values.get(key)); } }