List of usage examples for java.util Dictionary get
public abstract V get(Object key);
From source file:Main.java
public static void main(String[] args) { Dictionary d = new Hashtable(); // add 2 elements d.put(1, "Cocoa"); d.put(4, "from java2s.com" + "Bar"); System.out.println("1 is " + d.get(1)); System.out.println("4 is " + d.get(4)); // generates a series of elements, one at a time for (Enumeration e = d.elements(); e.hasMoreElements();) { System.out.println(e.nextElement()); }//from w w w . j a va 2s. co m }
From source file:Main.java
public static void main(String[] args) { Dictionary d = new Hashtable(); // add some elements d.put("1", "from java2s.com"); d.put("2", "Cocoa"); d.put("5", "from java2s.com"); // remove one element System.out.println(d.get("5")); System.out.println(d.remove("5") + " has been removed"); System.out.println(d.get("5")); }
From source file:MainClass.java
static void show(Dictionary d) { System.out.println("a: " + d.get("a")); System.out.println("b: " + d.get("b")); System.out.println("c: " + d.get("c")); System.out.println("d: " + d.get("d")); }
From source file:Main.java
/** * Returns the {@value #BLUEPRINT_HEADER} if present from the given dictionary. * //from w w w . j a v a2s . co m * @param headers * @return */ public static String getBlueprintHeader(Dictionary headers) { Object header = null; if (headers != null) header = headers.get(BLUEPRINT_HEADER); return (header != null ? header.toString().trim() : null); }
From source file:org.opencastproject.util.OsgiUtil.java
/** Get a value from a dictionary. Return none if the key does either not exist or the value is blank. */ public static Option<String> getOptCfg(Dictionary d, String key) { return option(d.get(key)).bind(Strings.asString()).bind(Strings.trimToNone); }
From source file:ch.entwine.weblounge.bridge.oaipmh.util.OsgiUtil.java
/** * Get a mandatory, non-blank value from a dictionary. * /*from ww w. j a v a 2 s . c om*/ * @throws ConfigurationException * key does not exist or its value is blank */ public static String getCfg(Dictionary d, String key) throws ConfigurationException { Object p = d.get(key); if (p == null) throw new ConfigurationException(key, "does not exist"); String ps = p.toString(); if (StringUtils.isBlank(ps)) throw new ConfigurationException(key, "is blank"); return ps; }
From source file:org.eclipse.virgo.ide.beans.core.internal.locate.SpringOsgiConfigLocationUtils.java
/** * Return the {@value #SPRING_CONTEXT_HEADER} if present from the given dictionary. *//*from w w w . j ava2 s . c o m*/ public static String getSpringContextHeader(Dictionary<String, String> headers) { Object header = null; if (headers != null) header = headers.get(SPRING_CONTEXT_HEADER); return (header != null ? header.toString().trim() : null); }
From source file:org.eclipse.virgo.ide.beans.core.internal.locate.BlueprintConfigUtils.java
/** * Returns the {@value #BLUEPRINT_HEADER} if present from the given dictionary. */// w w w.ja v a2s. co m public static String getBlueprintHeader(Dictionary<String, String> headers) { Object header = null; if (headers != null) header = headers.get(BLUEPRINT_HEADER); return (header != null ? header.toString().trim() : null); }
From source file:org.ow2.chameleon.core.utils.BundleHelper.java
/** * Checks if a bundle is a fragment.//from w ww .j a va 2s .c o m * It checks if the manifest contains the fragment * host header. * * @param bundle the bundle to check * @return true if the bundle is a fragment. */ public static boolean isFragment(Bundle bundle) { Dictionary<String, String> headers = bundle.getHeaders(); return headers.get(Constants.FRAGMENT_HOST) != null; }
From source file:org.eclipse.skalli.testutil.BundleManager.java
/** * Checks if the given bundle is a fragment. * @param bundle the bundle to check.//from ww w.j a v a2 s . c o m * @return <code>true</code> if the bundle has a <tt>Fragment-Host</tt> header * in its manifest, <code>false</code> otherwise. */ public static boolean isFragment(Bundle bundle) { Dictionary<String, String> headers = bundle.getHeaders(); return StringUtils.isNotBlank(headers.get("Fragment-Host")); //$NON-NLS-1$ }