List of usage examples for java.util HashMap get
public V get(Object key)
From source file:sas.BarChart.java
public static CategoryDataset createProfitDataset(HashMap<String, Float> lsh) { DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset(); for (String sh : lsh.keySet()) { defaultcategorydataset.addValue(lsh.get(sh), "Profit", sh); }/* w ww . j a v a2 s . co m*/ return defaultcategorydataset; }
From source file:sas.BarChart.java
public static CategoryDataset createPriceDataset(HashMap<String, Float> lsh) { DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset(); for (String sh : lsh.keySet()) { defaultcategorydataset.addValue(lsh.get(sh), "Prices", sh); }/*w w w. ja v a 2 s . c o m*/ return defaultcategorydataset; }
From source file:eu.scape_project.hawarp.utils.StringUtils.java
public static String normaliseMimetype(String mime) { String normalised = getStrUntilChar(mime, ";"); HashMap<String, String> replMap = new HashMap<String, String>(); replMap.put("no-type", "application/octet-stream"); for (String key : replMap.keySet()) { if (normalised.contains(key)) { normalised = normalised.replace(key, replMap.get(key)); }//ww w. j a v a 2s . c o m } return normalised.toLowerCase(); }
From source file:com.austin.base.commons.util.StringUtil.java
/** * @param map ?HashMap//from w ww.j av a 2 s. c om */ public static void printMap(HashMap map) { java.util.Iterator iterator = map.keySet().iterator(); Object key = null; Object obj = null; while (iterator.hasNext()) { key = iterator.next(); obj = map.get(key); System.out.println("key:" + key + " value:" + obj); } }
From source file:com.clustercontrol.accesscontrol.util.UserRoleCache.java
/** * ???????/* w w w . j a v a 2 s . co m*/ * * @param roleId ID * @return ??? * @throws HinemosUnknown */ public static List<SystemPrivilegeInfo> getSystemPrivilegeList(String roleId) throws HinemosUnknown { m_log.debug("getSystemPrivilegeList() : roleId " + roleId); // ????????????????????????? // (?????????????????????????) HashMap<String, ArrayList<SystemPrivilegeInfo>> cache = getRoleSystemPrivilegeCache(); return cache.get(roleId); }
From source file:com.zimbra.cs.util.yauth.TokenAuthenticateV1.java
/** * @param username/*www .ja v a 2 s . c o m*/ * @param token THIS IS NOT THE PASSWORD -- use the static getToken() method * to get the user's token * @return */ public static TokenAuthenticateV1 doAuth(String username, String token) throws IOException, HttpException { GetMethod method = new GetMethod("https://login.yahoo.com/config/pwtoken_login?src=ymsgr&token=" + token); int response = HttpClientUtil.executeMethod(method); if (response >= 200 && response < 300) { String body = method.getResponseBodyAsString(); HashMap<String, String> map = new HashMap<String, String>(); map.put("crumb", null); map.put("Y", null); map.put("T", null); parseResponseBody(body, map); return new TokenAuthenticateV1(map.get("crumb"), map.get("Y"), map.get("T")); } else { throw new IOException("HTTPClient response: " + response); } }
From source file:bencoding.securely.Converters.java
@SuppressWarnings("rawtypes") public static Object toJSON(Object object) throws JSONException { if (object instanceof HashMap) { JSONObject json = new JSONObject(); HashMap hashmap = (HashMap) object; for (Object key : hashmap.keySet()) { json.put(key.toString(), toJSON(hashmap.get(key))); }/*from w w w . j a v a2 s.co m*/ return json; } else if (object instanceof Map) { JSONObject json = new JSONObject(); Map map = (Map) object; for (Object key : map.keySet()) { json.put(key.toString(), toJSON(map.get(key))); } return json; } else if (object instanceof Iterable) { JSONArray json = new JSONArray(); for (Object value : ((Iterable) object)) { json.put(toJSON(value)); } return json; } else { return object; } }
From source file:sas.BarChart.java
public static CategoryDataset createSaleDataset(java.util.HashMap<String, Float> lsh) { DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset(); for (String sh : lsh.keySet()) { defaultcategorydataset.addValue(lsh.get(sh), "Sales", sh); }//from w w w .ja v a 2s . c om return defaultcategorydataset; }
From source file:org.hfoss.posit.android.web.PositHttpUtils.java
/** * Returns the NameValuePair objects required * @param nameValuesMap/*from w ww. ja v a 2s. c o m*/ * @return */ public static List<NameValuePair> getNameValuePairs(HashMap<String, String> nameValuesMap) { Iterator<String> iter = nameValuesMap.keySet().iterator(); List<NameValuePair> nvp = new ArrayList<NameValuePair>(); while (iter.hasNext()) { String key = iter.next(); String value = nameValuesMap.get(key); nvp.add(new BasicNameValuePair(key, value)); } return nvp; }
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 www . j a v a2 s .co 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; }