List of usage examples for java.util NavigableMap values
Collection<V> values();
From source file:org.nuclos.server.navigation.ejb3.TreeNodeFacadeBean.java
private void subformSubnodes(final List<TreeNode> result, TreeNode node, Collection<MasterDataVO> mds, Collection<EntityTreeViewVO> etvs) { final Iterator<MasterDataVO> it1 = mds.iterator(); final Iterator<EntityTreeViewVO> it2 = etvs.iterator(); final NavigableMap<Integer, List<? extends TreeNode>> subforms = new TreeMap<Integer, List<? extends TreeNode>>(); // add subnodes defined in the module meta data while (it1.hasNext()) { final MasterDataVO mdvoSub = it1.next(); final EntityTreeViewVO etv = it2.next(); assert etv.getEntity().equals(mdvoSub.getField(EntityTreeViewVO.SUBFORM_ENTITY_FIELD)); assert etv.getField().equals(mdvoSub.getField(EntityTreeViewVO.SUBFORM2ENTITY_REF_FIELD)); // This seems to be all right - except for bmw-fdm. (tp) /*/* www . j a va 2s. c om*/ assert IdUtils.equals(etv.getOriginentityid(), mdvoSub.getId()) : "org: " + etv.getOriginentityid() + " sub: " + mdvoSub.getIntId(); */ final String entity = etv.getEntity(); final String field = etv.getField(); final String foldername = etv.getFoldername(); final boolean active = etv.isActive(); final Integer sortOrder = etv.getSortOrder() == null ? Integer.valueOf(0) : etv.getSortOrder(); if (node instanceof GenericObjectTreeNode) { final GenericObjectTreeNode gotn = (GenericObjectTreeNode) node; // check whether the user has the right to see the subform data Permission permission = SecurityCache.getInstance().getSubForm(getCurrentUserName(), entity) .get(gotn.getStatusId()); if (permission == null || !permission.includesReading()) { continue; } } if (active) { if (!org.apache.commons.lang.StringUtils.isBlank(foldername)) { if (node instanceof GenericObjectTreeNode || node instanceof MasterDataTreeNode) { // only allow Treenodes of those types. SubFormTreeNode treenode = new SubFormTreeNode<Integer>(null, node, mdvoSub); treenode.getSubNodes(); subforms.put(sortOrder, Collections.singletonList(treenode)); } } else { if (Modules.getInstance().isModuleEntity(entity)) { subforms.put(sortOrder, getModuleSubNodes(node, entity, field)); } else { subforms.put(sortOrder, getMasterDataSubNodes(node, entity, field)); } } } } for (List<? extends TreeNode> l : subforms.values()) { result.addAll(l); } }
From source file:com.google.gwt.emultest.java.util.TreeMapTest.java
/** * Test method for 'java.util.Map.values()'. * * @see java.util.Map#values()/*from w w w .j a va2 s . c o m*/ */ public void testValues() { K[] keys = getSortedKeys(); V[] values = getSortedValues(); NavigableMap<K, V> map = createNavigableMap(); map.put(keys[0], values[0]); Collection<V> mapValues = map.values(); assertNotNull(mapValues); assertEquals(1, mapValues.size()); Iterator<V> valueIter = mapValues.iterator(); assertEquals(values[0], valueIter.next()); _assertEquals(mapValues, map.values()); mapValues.clear(); _assertEmpty(map); for (int i = 0; i < keys.length; i++) { map.put(keys[i], values[i]); } mapValues.iterator(); assertEquals(map.size(), mapValues.size()); for (V value : values) { assertTrue(mapValues.contains(value)); } assertEquals(values.length, mapValues.size()); int size = 0; for (Iterator iter = mapValues.iterator(); iter.hasNext(); iter.next()) { size++; } assertEquals(values.length, size); mapValues = map.descendingMap().values(); mapValues.iterator(); assertEquals(map.size(), mapValues.size()); for (V value : values) { assertTrue(mapValues.contains(value)); } assertEquals(values.length, mapValues.size()); size = 0; for (Iterator iter = mapValues.iterator(); iter.hasNext(); iter.next()) { size++; } assertEquals(values.length, size); mapValues = map.values(); mapValues.remove(values[0]); assertTrue(!map.containsValue(values[0])); assertEquals(values.length - 1, mapValues.size()); size = 0; for (Iterator iter = mapValues.iterator(); iter.hasNext(); iter.next()) { size++; } assertEquals(values.length - 1, size); }