List of usage examples for java.util Map entrySet
Set<Map.Entry<K, V>> entrySet();
From source file:jp.crudefox.oauth2play2.oauth2.common.utils.JSONUtils.java
public static String buildJSON(Map<String, Object> params) throws JSONException { JSONObject jsonObject = new JSONObject(); for (Map.Entry<String, Object> param : params.entrySet()) { if (param.getKey() != null && !"".equals(param.getKey()) && param.getValue() != null && !"".equals(param.getValue())) { jsonObject.put(param.getKey(), param.getValue()); }/*from ww w. j a v a 2s . c o m*/ } return jsonObject.toString(); }
From source file:Main.java
private static void addMap(StringBuffer manifest, Map values, String assignment) { if (values == null) return; // nothing to add for (Iterator iEntries = values.entrySet().iterator(); iEntries.hasNext();) { manifest.append(ELEMENT_SEPARATOR); Map.Entry entry = (Entry) iEntries.next(); manifest.append(entry.getKey()).append(assignment).append('\"'); Object value = entry.getValue(); if (value instanceof String[]) { String[] strings = (String[]) value; for (int i = 0; i < strings.length; i++) { if (i != 0) manifest.append(','); manifest.append(strings[i]); }//from w ww .j av a 2 s. c o m } else { manifest.append(value); } manifest.append('\"'); } }
From source file:Main.java
/** * Create a Hash table from supplied Map, this is passed to Hessian encoder * to create Hessian encoded request body. * /* w w w. j ava 2s. c o m*/ * @param map The source map. * @return Hash table from supplied Map. */ protected static Hashtable<String, Object> createHashTable(Map<String, List<String>> map) { Hashtable<String, Object> hashtable = new Hashtable<String, Object>(); Set<Map.Entry<String, List<String>>> set = map.entrySet(); for (Map.Entry<String, List<String>> obj : set) { hashtable.put(obj.getKey(), new Vector<String>(obj.getValue())); } return hashtable; }
From source file:Main.java
public static Map splitAll(Map list, String separator) { if (list == null) return null; Map result = new HashMap(); java.util.Map.Entry entry;/*from ww w. j a v a2s . co m*/ for (Iterator i$ = list.entrySet().iterator(); i$.hasNext(); result.put(entry.getKey(), split((List) entry.getValue(), separator))) entry = (java.util.Map.Entry) i$.next(); return result; }
From source file:Main.java
public static void writeStringMap(Map<String, String> map, Parcel parcel) { if (map != null && map.size() > 0) { parcel.writeInt(map.size());/* ww w .j a v a 2 s .c o m*/ for (Map.Entry<String, String> entry : map.entrySet()) { parcel.writeString(entry.getKey()); parcel.writeString(entry.getValue()); } } else { parcel.writeInt(0); } }
From source file:de.tynne.benchmarksuite.Main.java
/** Returns a single suite for benchmarks by name. *///from ww w.j a v a2s . c o m private static Optional<BenchmarkProducer> findByName(String suite, Map<BenchmarkSuite, BenchmarkProducer> suites) { return suites.entrySet().stream().filter(e -> nameFor(e.getKey(), e.getValue()).equalsIgnoreCase(suite)) .map(e -> e.getValue()).findFirst(); }
From source file:Main.java
/** * Set the <code>schemaLocationAttribute</code> to the values of the * <code>schemaLocationMap</code>. * //from www.j ava 2 s . co m * @see <a href="http://www.w3.org/TR/xmlschema-0/#schemaLocation">XML Schema * Part 0: Primer Second Edition | 5.6 schemaLocation</a> * * @param schemaLocationMap * {@link Map} to get schema locations from. * @since 8.1 */ private static final String getSchemaLocationValue(final Map<String, List<String>> schemaLocationMap) { final StringBuilder sb = new StringBuilder(); for (final Map.Entry<String, List<String>> entry : schemaLocationMap.entrySet()) { for (final String schemaLocation : entry.getValue()) { if (sb.length() > 0) { sb.append(' '); } sb.append(entry.getKey()).append(' ').append(schemaLocation); } } return sb.toString(); }
From source file:service.ProcessService.java
private static boolean validate(Map<DSLContainer, Object> dcMap) { boolean result = true; for (Map.Entry<DSLContainer, Object> entry : dcMap.entrySet()) { result &= DSLManager.validate(entry.getKey()); }/*from w w w . j a va 2 s .c om*/ return result; }
From source file:com.blackboard.WebdavBulkDeleterClient.java
private static void verifyOptions(CommandLine line, Map<String, String> options) throws ParseException { Iterator<Entry<String, String>> it = options.entrySet().iterator(); boolean error = false; // Let's be optimistic while (it.hasNext()) { Map.Entry<String, String> pairs = it.next(); if (line.hasOption(pairs.getKey()) == false) { logger.error("Please specify option --" + pairs.getKey()); error = true;//from w w w .j av a 2 s . c o m } } if (error) { throw new ParseException("Required arguments missing"); } }
From source file:com.joliciel.talismane.utils.DaoUtils.java
public static void LogParameters(Map<String, Object> paramMap, Log log) { if (log.isTraceEnabled()) { for (Object obj : paramMap.entrySet()) { @SuppressWarnings("rawtypes") Entry entry = (Entry) obj;//w w w. java 2 s . com log.trace( entry.getKey() + ": " + (entry.getValue() == null ? "null" : entry.getValue().toString())); } } }