List of usage examples for java.util Map keySet
Set<K> keySet();
From source file:com.globalsight.util.JfreeCharUtil.java
private static PieDataset buildDatas(Map<String, Double> datas) { DefaultPieDataset dataset = new DefaultPieDataset(); for (String key : datas.keySet()) { dataset.setValue(key, datas.get(key)); }//from w ww . j av a 2 s . c om return dataset; }
From source file:com.baasbox.db.hook.HooksManager.java
public static void unregisteredAll(ODatabaseRecordTx db) { if (BaasBoxLogger.isTraceEnabled()) BaasBoxLogger.trace("Method Start"); if (BaasBoxLogger.isDebugEnabled()) BaasBoxLogger.debug("unregistering hooks..."); //OrientDB 1.7: Map<ORecordHook, HOOK_POSITION> hooks = db.getHooks(); List hs = IteratorUtils.toList(hooks.keySet().iterator()); Iterator<ORecordHook> it = hs.iterator(); while (it.hasNext()) { ORecordHook h = it.next();//w w w .j a v a2 s .c om if (h instanceof BaasBoxHook) { if (BaasBoxLogger.isDebugEnabled()) BaasBoxLogger.debug("Removing " + ((BaasBoxHook) h).getHookName() + " hook"); db.unregisterHook(h); } } if (BaasBoxLogger.isTraceEnabled()) BaasBoxLogger.trace("Method End"); }
From source file:net.pickapack.util.JaxenHelper.java
/** * Dump the value under the specified object using the specified expression. * * @param stats the map of statistics//from w w w . jav a2 s . c o m * @param object the parent object * @param expression the selection expression */ public static void dumpValueFromXPath(Map<String, String> stats, Object object, String expression) { Object resultObj = selectSingleNode(object, expression); if (resultObj != null) { if (resultObj instanceof Map) { Map resultMap = (Map) resultObj; for (Object key : resultMap.keySet()) { stats.put(escape(expression) + "/" + key, toString(resultMap.get(key))); } } else { stats.put(escape(expression), toString(resultObj)); } } else { throw new IllegalArgumentException(); } }
From source file:com.squarespace.template.plugins.platform.CommerceUtilsTest.java
private static List<String> extractTests(Map<String, JsonNode> jsonMap) { List<String> tests = new ArrayList<>(); for (String key : jsonMap.keySet()) { if (!key.endsWith("-expected")) { tests.add(key);/*from w ww . j a va 2 s . c om*/ } } return tests; }
From source file:Main.java
public static List<String> getSortedGPXFilenamesByDate(File dir, boolean absolutePath) { final Map<String, Long> mp = new HashMap<String, Long>(); readGpxDirectory(dir, mp, "", absolutePath); ArrayList<String> list = new ArrayList<String>(mp.keySet()); Collections.sort(list, new Comparator<String>() { @Override// w w w. java 2s .c om public int compare(String object1, String object2) { Long l1 = mp.get(object1); Long l2 = mp.get(object2); long lhs = l1 == null ? 0 : l1.longValue(); long rhs = l2 == null ? 0 : l2.longValue(); return lhs < rhs ? 1 : (lhs == rhs ? 0 : -1); } }); return list; }
From source file:com.weibo.api.motan.config.ConfigUtil.java
public static String extractProtocols(String export) { Map<String, Integer> protocols = parseExport(export); StringBuilder sb = new StringBuilder(16); for (String p : protocols.keySet()) { sb.append(p).append(MotanConstants.COMMA_SEPARATOR); }/*from w w w . j a v a 2 s. c o m*/ if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
From source file:Main.java
/** * Remove duplicate values of list from map * @param values - Map of values//from www. j a va 2 s . co m * @param <T> - Object class * @param <K> - Key * @return - Result Map without duplcates */ public static <T, K> Map<K, List<T>> removeDuplicateValues(Map<K, List<T>> values) { if (values == null) { return values; } Map<K, List<T>> newValues = new LinkedHashMap<K, List<T>>(); for (K key : values.keySet()) { newValues.put(key, removeDuplicateValues(values.get(key))); } return newValues; }
From source file:Main.java
private static List<String> filterParamNamesWithObjectValue(Map<String, Object> paramValueMap, List<String> ignoreParamNameList) { List<String> filteredParamNames = new ArrayList<>(paramValueMap.size()); filteredParamNames.addAll(paramValueMap.keySet()); if (ignoreParamNameList != null && ignoreParamNameList.size() > 0) { for (String ignoreParamName : ignoreParamNameList) { filteredParamNames.remove(ignoreParamName); }/*from www . java2 s . c o m*/ } return filteredParamNames; }
From source file:com.baasbox.db.hook.HooksManager.java
public static void registerAll(ODatabaseRecordTx db) { if (BaasBoxLogger.isTraceEnabled()) BaasBoxLogger.trace("Method Start"); if (BaasBoxLogger.isDebugEnabled()) BaasBoxLogger.debug("Registering hooks..."); //we have to check if the hooks have been already registered since the connections could be reused due to pool boolean register = true; //OrientDB 1.7: Map<ORecordHook, HOOK_POSITION> hooks = db.getHooks(); Iterator<ORecordHook> it = hooks.keySet().iterator(); while (it.hasNext()) { if (it.next() instanceof BaasBoxHook) { if (BaasBoxLogger.isDebugEnabled()) BaasBoxLogger.debug("BaasBox hooks already registerd for this connection"); register = false;//w w w. ja v a2 s. co m break; } } if (register) { if (BaasBoxLogger.isDebugEnabled()) BaasBoxLogger.debug("Registering BaasBox hooks... start"); db.registerHook(Audit.getIstance(), HOOK_POSITION.REGULAR); db.registerHook(HidePassword.getIstance(), HOOK_POSITION.LAST); if (BaasBoxLogger.isDebugEnabled()) BaasBoxLogger.debug("Registering BaasBox hooks... done"); } if (BaasBoxLogger.isDebugEnabled()) BaasBoxLogger.debug("Hooks: " + db.getHooks()); if (BaasBoxLogger.isTraceEnabled()) BaasBoxLogger.trace("Method End"); }
From source file:com.microsoft.azure.shortcuts.resources.samples.ProvidersSample.java
public static void test(Subscription subscription) throws Exception { // List provider namespaces Map<String, Provider> providers = subscription.providers().asMap(); System.out/*w w w.j a v a 2 s.c om*/ .println(String.format("Provider namespaces: %s\t", StringUtils.join(providers.keySet(), "\n\t"))); // List providers for (Provider provider : providers.values()) { System.out.println(provider.id() + " - " + provider.registrationState()); } if (providers.size() > 0) { // Get information about a specific provider Provider provider = subscription.providers("microsoft.classicstorage"); System.out.println(String.format( "Found provider: %s\n" + "\tRegistration State: %s\n" + "\tAPI versions for resource types:", provider.id(), provider.registrationState())); for (ResourceType t : provider.resourceTypes().values()) { System.out.println(String.format("\t\t%s: %s", t.id(), StringUtils.join(t.apiVersions(), ", "))); } // Get latest API version for a specific resource type String resourceType = "storageAccounts"; System.out.println(String.format("\n\t\tLatest version for type %s: %s", resourceType, provider.resourceTypes().get(resourceType).latestApiVersion())); // Get latest API version for a specific resource type - shortcut System.out.println(String.format("\n\t\tLatest version for type %s: %s", resourceType, provider.resourceTypes(resourceType).latestApiVersion())); } }