List of usage examples for com.google.common.collect Maps filterValues
@CheckReturnValue public static <K, V> BiMap<K, V> filterValues(BiMap<K, V> unfiltered, final Predicate<? super V> valuePredicate)
From source file:org.onosproject.cluster.LeadershipService.java
/** * Returns the set of topics owned by the specified {@link NodeId node}. * * @param nodeId node identifier.// www . jav a 2 s.c om * @return set of topics for which this node is the current leader. */ default Set<String> ownedTopics(NodeId nodeId) { return Maps.filterValues(getLeaderBoard(), v -> Objects.equal(nodeId, v.leaderNodeId())).keySet(); }
From source file:graph.features.degree.Degree.java
@Override public Map<T, Integer> getNodesHavingDegree(final int degree) { return Maps.filterValues(this.getData(), Integers.Predicates.is(degree)); }
From source file:com.codemacro.jcm.health.HealthCheckManager.java
public Map<String, Cluster> getCheckClusters(final CheckType checkType) { return Maps.filterValues(checkClusters, new Predicate<Cluster>() { public boolean apply(Cluster cluster) { return cluster.getOnline() == OnlineStatus.ONLINE && cluster.getCheckType().equals(checkType); }//from w w w . j av a 2 s.c om }); }
From source file:org.onosproject.cluster.impl.LeadershipManager.java
@Deactivate public void deactivate() { Maps.filterValues(store.getLeaderships(), v -> v.candidates().contains(localNodeId)).keySet() .forEach(this::withdraw); store.unsetDelegate(delegate);//www .j av a 2s .c om eventDispatcher.removeSink(LeadershipEvent.class); log.info("Stopped"); }
From source file:graph.features.degree.Degree.java
@Override public Map<T, Integer> getNodesNotHavingDegree(final int degree) { return Maps.filterValues(this.getData(), Integers.Predicates.isNot(degree)); }
From source file:com.torodb.core.transaction.metainf.WrapperMutableMetaCollection.java
public WrapperMutableMetaCollection(ImmutableMetaCollection wrappedCollection, Consumer<WrapperMutableMetaCollection> changeConsumer) { this.wrapped = wrappedCollection; this.changeConsumer = changeConsumer; this.newDocParts = new HashMap<>(); modifiedMetaDocParts = new HashSet<>(); wrappedCollection.streamContainedMetaDocParts().forEach((docPart) -> { WrapperMutableMetaDocPart mutable = createMetaDocPart(docPart); newDocParts.put(mutable.getTableRef(), mutable); });// w w w .j av a2 s.c o m this.indexesByName = new HashMap<>(); wrappedCollection.streamContainedMetaIndexes().forEach((index) -> { WrapperMutableMetaIndex mutable = createMetaIndex(index); indexesByName.put(mutable.getName(), new Tuple2<>(mutable, MetaElementState.NOT_CHANGED)); }); aliveIndexesMap = Maps.filterValues(indexesByName, tuple -> tuple.v2().isAlive()); }
From source file:no.ssb.vtl.script.operations.check.CheckSingleRuleOperation.java
private void checkDataStructure(Dataset dataset) { int noIdentifiers = Maps .filterValues(dataset.getDataStructure().getRoles(), role -> role == Component.Role.IDENTIFIER) .size();/*w w w.j a v a 2 s.c om*/ checkArgument(noIdentifiers > 0, "dataset does not have identifier components"); }
From source file:org.gradle.model.internal.manage.schema.extract.CandidateMethods.java
/** * @param methodName Method name/* w w w . ja v a 2 s.co m*/ * @return Overridden candidate methods named {@literal methodName} indexed by signature equivalence or * {@literal null} if none */ public Map<Equivalence.Wrapper<Method>, Collection<Method>> overriddenMethodsNamed(String methodName) { if (candidates.containsKey(methodName)) { return Maps.filterValues(candidates.get(methodName), new Predicate<Collection<Method>>() { @Override public boolean apply(Collection<Method> equivalentMethods) { return equivalentMethods.size() > 1; } }); } return Collections.<Equivalence.Wrapper<Method>, Collection<Method>>emptyMap(); }
From source file:net.awired.visuwall.server.web.controller.MainController.java
@RequestMapping(ROOT_CONTEXT) public ModelAndView getIndex(ModelMap modelMap) throws Exception { Map<String, Object> jsData = new HashMap<String, Object>(); Map<String, Object> init = new HashMap<String, Object>(); jsData.put("init", init); Map<File, String> jsMap = jsService.getJsFiles(); JsServiceMap serviceMap = jsService.buildServiceMapFromJsMap(jsMap); Predicate<List<String>> predicate = new Predicate<List<String>>() { @Override/* www .j a va 2 s. c om*/ public boolean apply(List<String> value) { for (String string : value) { return string.startsWith("visuwall"); } return true; } }; Map<String, List<String>> val = Maps.filterValues(serviceMap, predicate); Map<String, List<String>> serviceMethods = jsService.getServicesMethods(jsMap, val); jsData.put("jsServiceMethod", serviceMethods); jsData.put("jsService", val); init.put("wallNames", wallService.getWallNames()); modelMap.put("jsData", jsonService.serialize(jsData)); modelMap.put("jsLinks", jsService.getJsLinks("res/", jsMap)); modelMap.put("cssLinks", cssService.getCssLinks("res/")); modelMap.put("version", visuwallApplication.getVersion()); return new ModelAndView("index", modelMap); }
From source file:org.jclouds.functions.ExpandProperties.java
private Map<String, String> leafs(Map<String, String> input) { return Maps.filterValues(input, new Predicate<String>() { @Override/*w w w.java2 s . c o m*/ public boolean apply(String input) { Matcher m = VAR.matcher(input); return !m.find(); } }); }