List of usage examples for java.util Map keySet
Set<K> keySet();
From source file:com.redhat.rhn.domain.monitoring.test.MonitoringTestUtils.java
public static void setupParamValues(ActionHelper ah, Map params, int multiplicity) { for (Iterator i = params.keySet().iterator(); i.hasNext();) { String name = (String) i.next(); for (int j = 0; j < multiplicity; j++) { ah.getRequest().setupAddParameter("param_" + name, (String) params.get(name)); }/*from ww w .j a v a 2 s .c om*/ } }
From source file:Main.java
public static void dumpWeightedGraph(Map<Integer, Map<Integer, Integer>> weightedGraph) { System.out.println("Start of dumping weighted graph... graphSize: " + weightedGraph.size()); for (int vertexId : weightedGraph.keySet()) { // System.out.println("vertexId: " + vertexId); Map<Integer, Integer> weightedNeighbors = weightedGraph.get(vertexId); for (int neighborId : weightedNeighbors.keySet()) { if (weightedNeighbors.get(neighborId) > 1) { System.out.println( "w(" + vertexId + ", " + neighborId + "): " + weightedNeighbors.get(neighborId)); }//w w w. j a v a 2 s . com } } System.out.println("End of dumping weighted graph..."); }
From source file:Main.java
public static <T> List<T> allExistedThreadLocalValues(ThreadLocal<T> variable) { Map<Thread, StackTraceElement[]> allStackTraces = Thread.getAllStackTraces(); List<T> result = new ArrayList<T>(); Set<Thread> allThreads = allStackTraces.keySet(); for (Thread thread : allThreads) { T v = getValue(variable, thread); if (v != null) result.add(v);//from ww w .j av a 2 s . com } return result; }
From source file:com.textocat.textokit.eval.EvaluationLauncher.java
public static void runUsingProperties(Properties configProperties) throws Exception { GenericApplicationContext appCtx = new GenericApplicationContext(); appCtx.getEnvironment().getPropertySources() .addLast(new PropertiesPropertySource("configFile", configProperties)); XmlBeanDefinitionReader xmlBDReader = new XmlBeanDefinitionReader(appCtx); xmlBDReader.loadBeanDefinitions(APP_CONTEXT_LOCATION); // register listeners Map<String, String> listenerImpls = getPrefixedKeyPairs(configProperties, PREFIX_LISTENER_ID); for (String listenerId : listenerImpls.keySet()) { String listenerClass = listenerImpls.get(listenerId); BeanDefinitionBuilder bb = genericBeanDefinition(listenerClass); Map<String, String> listenerProperties = getPrefixedKeyPairs(configProperties, PREFIX_LISTENER_PROPERTY + listenerId + "."); for (String propName : listenerProperties.keySet()) { bb.addPropertyValue(propName, listenerProperties.get(propName)); }// ww w.ja v a 2s. c om appCtx.registerBeanDefinition(listenerId, bb.getBeanDefinition()); } appCtx.refresh(); appCtx.registerShutdownHook(); GoldStandardBasedEvaluation eval = appCtx.getBean(GoldStandardBasedEvaluation.class); eval.run(); }
From source file:Main.java
/** * use ? & make a full url/* w ww . j a va2 s. c o m*/ * @param p_url * @param params * @return */ public static String makeURL(String p_url, Map<String, String> params) { StringBuilder url = new StringBuilder(p_url); if (url.indexOf("?") < 0) url.append('?'); for (String name : params.keySet()) { url.append('&'); url.append(name); url.append('='); url.append(String.valueOf(params.get(name))); } return url.toString().replace("?&", "?"); }
From source file:com.clover.sdk.v3.JsonHelper.java
public static Object toJSON(Object object) { if (object instanceof Map) { JSONObject json = new JSONObject(); Map map = (Map) object; for (Object key : map.keySet()) { try { json.putOpt(key.toString(), toJSON(map.get(key))); } catch (JSONException e) { /* ignore for now */ } }/*from ww w . j a va 2s. com*/ return json; } else if (object instanceof Iterable) { JSONArray json = new JSONArray(); for (Object value : ((Iterable) object)) { json.put(value); } return json; } else if (object instanceof Enum) { return ((Enum) object).name(); } else { return object; } }
From source file:com.espertech.esperio.csv.CSVPropertyOrderHelper.java
private static boolean eachPropertyNameRepresented(String[] row, Map<String, Object> propertyTypes) { Set<String> rowSet = new HashSet<String>(Arrays.asList(row)); return rowSet.containsAll(propertyTypes.keySet()); }
From source file:com.aliyun.openservices.odps.console.commands.logview.LogViewBaseAction.java
protected static String deduceTaskName(Instance inst) throws ODPSConsoleException, OdpsException { Map<String, TaskStatus> ss = inst.getTaskStatus(); if (ss.size() == 1) { for (String key : ss.keySet()) { return key; }/*from ww w. ja va2 s . co m*/ } else { throw new ODPSConsoleException( "Please specify one of these tasks with option '-t': " + StringUtils.join(ss.keySet(), ',')); } return null; }
From source file:com.microsoft.azure.shortcuts.resources.samples.ResourcesSample.java
public static void test(Subscription subscription) throws Exception { // Listing all resource names Map<String, Resource> resources = subscription.resources().asMap(); System.out.println(String.format("Resource ids: %s\n\t", StringUtils.join(resources.keySet(), ",\n\t"))); // Listing resources in a specific group String groupName = "azchat"; Map<String, Resource> resources2 = subscription.resources().asMap(groupName); System.out.println("Resources inside group '" + groupName + "':"); for (Resource resource : resources2.values()) { printResource(resource);//from w w w .j ava2 s .c o m } // Getting information about a specific resource based on ID Resource resource = subscription.resources( "/subscriptions/9657ab5d-4a4a-4fd2-ae7a-4cd9fbd030ef/resourceGroups/javasampleresourcegroup/providers/Microsoft.Storage/storageAccounts/javastojzgsg"); printResource(resource); // Getting information about a specific resource based on name, type, provider and group resource = subscription.resources().get(resource.name(), resource.type(), resource.provider(), resource.resourceGroup()); printResource(resource); // Delete a resource System.out.println(String.format("Deleting resource '%s' of type '%s' by provider '%s' in group '%s'", resource.name(), resource.type(), resource.provider(), resource.resourceGroup())); resource.delete(); // Delete a resource based on its ID String resourceToDelete = "ThisMustFail"; System.out.println("Deleting resource " + resourceToDelete); subscription.resources().delete(resourceToDelete); }
From source file:net.bioclipse.cir.business.CirManager.java
private static HttpMethodBase addMethodHeaders(HttpMethodBase method, Map<String, String> extraHeaders) { // add other headers if (extraHeaders != null) { for (String header : extraHeaders.keySet()) { method.setRequestHeader(header, extraHeaders.get(header)); }//ww w . ja va 2s . com } return method; }