List of usage examples for java.util Map values
Collection<V> values();
From source file:ca.sfu.federation.utils.IContextUtils.java
/** * Restore transient and non-serializable values. *//*from ww w. j a v a 2s.c o m*/ public static void restore(IContext Context) { // for each object, restore values Map map = Context.getElementMap(); Iterator iter = map.values().iterator(); while (iter.hasNext()) { Object object = iter.next(); if (object instanceof IUpdateable) { IUpdateable updateable = (IUpdateable) object; updateable.restore(); } } }
From source file:com.extjs.djn.spring.loader.SpringLoaderHelper.java
/** * Return the spring instance of a bean from is className. * /*from www . j a v a2s . co m*/ * Return null if no bean found. * * @param instanceClass * * @return */ public static Object getBeanOfType(Class<?> instanceClass) { Object bean = null; Map<String, Object> beansMap = getBeansOfType(instanceClass); if (beansMap.size() > 1) { throw new IllegalStateException("Only one instance of " + instanceClass + "is expected"); } else if (beansMap.size() == 1) { bean = beansMap.values().iterator().next(); } return bean; }
From source file:com.clustercontrol.util.EndpointManager.java
public static List<EndpointUnit> getActiveManagerList() { Map<String, EndpointUnit> activeManagerMap = getInstance().getActiveManagerMap(); return (0 < activeManagerMap.size()) ? new ArrayList<EndpointUnit>(activeManagerMap.values()) : new ArrayList<EndpointUnit>(); }
From source file:com.zb.app.external.lucene.search.build.SearchBuilder.java
public static VersionableSearch<?, ?> getSearch(SearchTypeEnum searchType) { try {/* w ww.j a v a2s . c om*/ @SuppressWarnings("rawtypes") Map beansOfType = SpringContextAware.getBeansOfType(searchType.getType()); for (Object object : beansOfType.values()) { // return first; return (VersionableSearch<?, ?>) object; } } catch (Exception e) { throw new SolrUnSupportException( String.format("Not Suppert SearchType ?%s", searchType.getDesc())); } // can't happend return null; }
From source file:com.l2jfree.gameserver.instancemanager.RaidPointsManager.java
public static int getPointsByOwnerId(int ownerId) { Map<Integer, Integer> tmpPoint = _list.get(ownerId); if (tmpPoint == null || tmpPoint.isEmpty()) return 0; int totalPoints = 0; for (int points : tmpPoint.values()) totalPoints += points;// ww w .ja v a 2 s .c om return totalPoints; }
From source file:cop.raml.processor.RestApi.java
@NotNull private static Resource add(@NotNull Map<String, Resource> resources, @NotNull String path) { path = path.startsWith("/") ? path : '/' + path; for (Resource resource : resources.values()) { String basePath = resource.getPath(); if (basePath.equals(path)) return resource; if (path.startsWith(basePath + '/')) return add(resource.children, StringUtils.removeStart(path, basePath)); String commonPath = findLongestPrefix(basePath, path); if (commonPath.isEmpty()) continue; Resource parent = new Resource(commonPath, resource); resources.remove(basePath);//ww w. ja v a 2 s . co m resources.put(parent.getPath(), parent); resource.removePathPrefix(commonPath); resource.removeUriParameters( parent.getUriParameters().stream().map(Parameter::getName).collect(Collectors.toList())); parent.children.put(resource.getPath(), resource); String suffix = StringUtils.removeStart(path, commonPath); if (StringUtils.isBlank(suffix)) return parent; return add(parent.children, StringUtils.removeStart(path, commonPath)); } Resource resource = new Resource(path); resources.put(resource.getPath(), resource); return resource; }
From source file:com.zotoh.cloudapi.core.CloudAPI.java
protected static Collection<VirtualMachineProduct> sort(Collection<VirtualMachineProduct> cs) { Map<VirtualMachineProduct, VirtualMachineProduct> m = new TreeMap<VirtualMachineProduct, VirtualMachineProduct>( new AAA()); for (VirtualMachineProduct p : cs) { m.put(p, p);/*from www . j ava 2 s . c o m*/ } return m.values(); }
From source file:com.hangum.tadpole.engine.restful.RESTfulAPIUtils.java
/** * Return SQL Paramter//from w w w.j a v a 2s .c o m * * @param strSQL * @return */ public static String getParameter(String strSQL) { String strArguments = ""; OracleStyleSQLNamedParameterUtil oracleNamedParamUtil = OracleStyleSQLNamedParameterUtil.getInstance(); oracleNamedParamUtil.parse(strSQL); Map<Integer, String> mapIndex = oracleNamedParamUtil.getMapIndexToName(); if (!mapIndex.isEmpty()) { for (String strParam : mapIndex.values()) { strArguments += String.format("%s={%s_value}&", strParam, strParam); } strArguments = StringUtils.removeEnd(strArguments, "&"); } else { strArguments = "";//1={FirstParameter}&2={SecondParameter}"; } return strArguments; }
From source file:gov.nih.nci.caarray.dao.HibernateIntegrationTestCleanUpUtility.java
@SuppressWarnings("unchecked") private static void retrieveClassMetadata() { Map<String, ClassMetadata> classMetadataMap = hibernateHelper.getSessionFactory().getAllClassMetadata(); classesToRemove = new LinkedList<Class<?>>(); for (ClassMetadata classMetadata : classMetadataMap.values()) { classesToRemove.add(classMetadata.getMappedClass(EntityMode.POJO)); }//from w w w .java2 s . c o m }
From source file:Main.java
@SuppressWarnings("unchecked") public static <T, U> U[] getValueArray(Map<T, U> m, Class<U> clazz) { if (m == null || m.size() == 0) { U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, 0); return Collections.<U>emptyList().toArray(a); } else {/*w w w .j a v a2 s. co m*/ U[] a = (U[]) java.lang.reflect.Array.newInstance(clazz, m.size()); return m.values().toArray(a); } }