List of usage examples for java.util HashMap put
public V put(K key, V value)
From source file:ca.ualberta.cs.c301f12t01.serverStorage.TaskServerRetrieval.java
/** * // w ww .j a v a 2s . c o m * @return HashMap of all global tasks */ public static HashMap<UUID, Task> getGlobalTasks() { ArrayList<Task> al = getAllTasks(); HashMap<UUID, Task> own = new HashMap<UUID, Task>(); for (Task t : al) { if (t.isGlobal()) { own.put(t.getId(), t); } } return own; }
From source file:com.sonicle.webtop.core.util.NotificationHelper.java
/** * Creates strings map for notification (simple body) template * @param locale// w w w .j av a 2 s. c o m * @param source * @param recipientEmail * @param bodyHeader * @param bodyMessage * @param becauseString * @return */ public static Map<String, String> createDefaultBodyTplStrings(Locale locale, String source, String recipientEmail, String bodyHeader, String bodyMessage, String becauseString) { HashMap<String, String> map = new HashMap<>(); map.put("bodyHeader", StringUtils.defaultString(bodyHeader)); map.put("bodyMessage", StringUtils.defaultString(bodyMessage)); map.put("footerHeader", MessageFormat.format( WT.lookupResource(CoreManifest.ID, locale, CoreLocaleKey.TPL_NOTIFICATION_FOOTER_HEADER), source)); map.put("footerMessage", MessageFormat.format( WT.lookupResource(CoreManifest.ID, locale, CoreLocaleKey.TPL_NOTIFICATION_FOOTER_MESSAGE), recipientEmail, becauseString)); return map; }
From source file:com.sonicle.webtop.core.util.NotificationHelper.java
/** * Creates strings map for notification (simple body) template * @param locale//from w ww .j a v a2s. c o m * @param source * @param recipientEmail * @param bodyHeader * @param customBody * @param becauseString * @return */ public static Map<String, String> createCustomBodyTplStrings(Locale locale, String source, String recipientEmail, String bodyHeader, String customBody, String becauseString) { HashMap<String, String> map = new HashMap<>(); map.put("bodyHeader", StringUtils.defaultString(bodyHeader)); map.put("customBody", StringUtils.defaultString(customBody)); map.put("footerHeader", MessageFormat.format( WT.lookupResource(CoreManifest.ID, locale, CoreLocaleKey.TPL_NOTIFICATION_FOOTER_HEADER), source)); map.put("footerMessage", MessageFormat.format( WT.lookupResource(CoreManifest.ID, locale, CoreLocaleKey.TPL_NOTIFICATION_FOOTER_MESSAGE), recipientEmail, becauseString)); return map; }
From source file:com.castlabs.dash.helpers.ManifestHelper.java
public static XmlOptions getXmlOptions() { XmlOptions xmlOptions = new XmlOptions(); //xmlOptions.setUseDefaultNamespace(); HashMap<String, String> ns = new HashMap<String, String>(); //ns.put("urn:mpeg:DASH:schema:MPD:2011", ""); ns.put("urn:mpeg:cenc:2013", "cenc"); ns.put("urn:mpeg:drmtdoday:cenc:2014", "drmtoday"); ns.put("urn:microsoft:playready", "mspr"); xmlOptions.setSaveSuggestedPrefixes(ns); xmlOptions.setSaveAggressiveNamespaces(); xmlOptions.setUseDefaultNamespace(); xmlOptions.setSavePrettyPrint();/*from w ww . j ava2 s .c om*/ return xmlOptions; }
From source file:cz.cas.lib.proarc.common.export.Kramerius4ExportOptions.java
public static Kramerius4ExportOptions from(Configuration config) { Kramerius4ExportOptions options = new Kramerius4ExportOptions(); String[] excludeIds = config.getStringArray(PROP_EXCLUDE_DATASTREAM_ID); options.setExcludeDatastreams(new HashSet<String>(Arrays.asList(excludeIds))); Configuration renames = config.subset(PROP_RENAME_PREFIX); HashMap<String, String> dsIdMap = new HashMap<String, String>(); // use RAW if FULL ds is not available dsIdMap.put(BinaryEditor.RAW_ID, "IMG_FULL"); for (Iterator<String> it = renames.getKeys(); it.hasNext();) { String dsId = it.next();//from w w w. jav a 2 s.c o m String newDsId = renames.getString(dsId); dsIdMap.put(dsId, newDsId); } options.setDsIdMap(dsIdMap); String policy = config.getString(PROP_POLICY); if (policy != null && !policy.isEmpty()) { options.setPolicy(policy); } return options; }
From source file:Main.java
/** * Finds the difference between two HashMaps a and b. * Returns a HashMap containing elements in b that are not in a * * @return the difference as a HashMap/*from ww w . j av a2 s. c o m*/ */ public static HashMap hashMapDifference(HashMap a, HashMap b) { Iterator bKeyIterator = b.keySet().iterator(); Object key; Object value; HashMap difference = new HashMap(); while (bKeyIterator.hasNext()) { key = bKeyIterator.next(); if (!a.containsKey(key)) { value = b.get(key); difference.put(key, value); } } return difference; }
From source file:com.ibm.bluej.commonutil.DenseVectors.java
public static HashMap<Integer, MutableDouble> toSparse(double[] v) { HashMap<Integer, MutableDouble> s = new HashMap<Integer, MutableDouble>(); for (int vi = 0; vi < v.length; ++vi) { s.put(vi, new MutableDouble(v[vi])); }// w w w . j a v a 2s .c o m return s; }
From source file:edu.ucsb.nceas.metacat.util.GeoserverUtil.java
/** * Change the password on the geoserver. The loginAdmin method must have * already been called using the same HttpClient that is passed to this * method./*w ww .jav a2s . co m*/ * * @param httpClient * the HttpClient we will use to post. This should have been used * in the login post. * @param username * the new user name * @param password * the new password */ public static void changePassword(HttpClient httpClient, String username, String password) throws MetacatUtilException { try { HashMap<String, String> paramMap = new HashMap<String, String>(); paramMap.put("username", username); paramMap.put("password", password); // Create the post url from values in metacat.properties String passwordPostPage = PropertyService.getProperty("geoserver.passwordPostPage"); String passwordPostURL = SystemUtil.getContextURL() + FileUtil.getFS() + passwordPostPage; String passwordSuccessString = PropertyService.getProperty("geoserver.passwordSuccessString"); logMetacat.debug("passwordPostURL: " + passwordPostURL); // Do the post String postResult = RequestUtil.post(httpClient, passwordPostURL, paramMap); // check to see if the success string is part of the result if (postResult.indexOf(passwordSuccessString) == -1) { logMetacat.debug(postResult); throw new MetacatUtilException("Could not change geoserver password."); } // send a post to apply the password changes. Unfortunately, there really // isn't anything of the geoserver side saying if the post passed, so we have // to assume it did. String applyPostPage = PropertyService.getProperty("geoserver.applyPostPage"); String applyPostURL = SystemUtil.getContextURL() + FileUtil.getFS() + applyPostPage; RequestUtil.post(httpClient, applyPostURL, null); } catch (PropertyNotFoundException pnfe) { throw new MetacatUtilException( "Property error while logging in with " + "default account: " + pnfe.getMessage()); } catch (IOException ioe) { throw new MetacatUtilException( "I/O error while logging in with " + "default account: " + ioe.getMessage()); } }
From source file:com.opengamma.analytics.util.amount.CubeValue.java
/** * Builder from on point./*from ww w. j av a 2s . c om*/ * @param point The surface point. * @param value The associated value. * @return The surface value. */ public static CubeValue from(final Triple<Double, Double, Double> point, final Double value) { ArgumentChecker.notNull(point, "Point"); final HashMap<Triple<Double, Double, Double>, Double> data = new HashMap<>(); data.put(point, value); return new CubeValue(data); }
From source file:net.itransformers.bgpPeeringMap.BgpPeeringMap.java
private static Map<String, String> loadProperties(File file) throws IOException { Properties props = new Properties(); props.load(new FileInputStream(file)); HashMap<String, String> settings = new HashMap<String, String>(); for (Object key : props.keySet()) { settings.put((String) key, (String) props.get(key)); }//from w w w .java 2 s . c o m return settings; }