List of usage examples for java.util Set forEach
default void forEach(Consumer<? super T> action)
From source file:com.blackducksoftware.integration.hub.detect.detector.npm.NpmCliParser.java
private void populateChildren(final MutableDependencyGraph graph, final Dependency parentDependency, final JsonObject parentNodeChildren, final Boolean root) { if (parentNodeChildren == null) { return;//from ww w . j ava 2 s .co m } final Set<Entry<String, JsonElement>> elements = parentNodeChildren.entrySet(); elements.forEach(it -> { if (it.getValue() != null && it.getValue().isJsonObject()) { } final JsonObject element = it.getValue().getAsJsonObject(); final String name = it.getKey(); String version = null; final JsonPrimitive versionPrimitive = element.getAsJsonPrimitive(JSON_VERSION); if (versionPrimitive != null && versionPrimitive.isString()) { version = versionPrimitive.getAsString(); } final JsonObject children = element.getAsJsonObject(JSON_DEPENDENCIES); if (name != null && version != null) { final ExternalId externalId = externalIdFactory.createNameVersionExternalId(Forge.NPM, name, version); final Dependency child = new Dependency(name, version, externalId); populateChildren(graph, child, children, false); if (root) { graph.addChildToRoot(child); } else { graph.addParentWithChild(parentDependency, child); } } }); }
From source file:org.obiba.mica.core.service.PersonService.java
@Async @Subscribe/*from w ww .j a v a 2 s. co m*/ public void micaConfigUpdated(MicaConfigUpdatedEvent event) { event.getRemovedRoles().forEach(r -> { log.info("Removing role {} from Persons.", r); Set<Person> persons = Sets.newHashSet(personRepository.findByStudyMembershipsRole(r)); persons.addAll(personRepository.findByNetworkMembershipsRole(r)); persons.forEach(p -> { p.removeAllMemberships(r); personRepository.save(p); eventBus.post(new PersonUpdatedEvent(p)); }); }); }
From source file:org.sonatype.nexus.selector.JexlSelector.java
@Override public boolean evaluate(final VariableSource variableSource) { if (expression.isPresent()) { Set<String> vars = variableSource.getVariableSet(); JexlContext jc = new MapContext(); // load the values, if present, into the context vars.forEach(variable -> variableSource.get(variable).ifPresent(value -> jc.set(variable, value))); Object o = expression.get().evaluate(jc); return (o instanceof Boolean) ? (Boolean) o : false; } else {//from w ww . j a v a 2 s . c o m return true; } }
From source file:edu.kit.dama.ui.admin.wizard.BaseMetadataExtractionAndIndexingCreation.java
@Override public void collectProperties(Map<String, String> properties) { if (createMetsExtractor.getValue()) { properties.put(WizardPersistHelper.METADATA_CREATE_EXTRACTOR, "yes"); Properties props = new Properties(); Set<Entry<String, TextField>> entries = extractorProperties.entrySet(); entries.forEach((entry) -> { props.put(entry.getKey(), entry.getValue().getValue()); });/*w w w . j a va 2 s . co m*/ try { properties.put(WizardPersistHelper.METADATA_EXTRACTOR_PROPERTIES, PropertiesUtil.propertiesToString(props)); } catch (IOException ex) { UIUtils7.showError("Failed to collect properties. Disabling metadata extraction."); properties.remove(WizardPersistHelper.METADATA_CREATE_EXTRACTOR); } } else { properties.remove(WizardPersistHelper.METADATA_CREATE_EXTRACTOR); } }
From source file:cn.codepub.redis.directory.io.InputOutputStream.java
default String[] getAllFileNames(String directoryMedata) { Objects.requireNonNull(directoryMedata); Set<byte[]> hkeys = hkeys(directoryMedata.getBytes()); Objects.requireNonNull(hkeys); ArrayList<String> names = Lists.newArrayList(); hkeys.forEach(key -> names.add(new String(key, StandardCharsets.UTF_8))); return names.toArray(ArrayUtils.EMPTY_STRING_ARRAY); }
From source file:ai.grakn.graql.internal.template.Scope.java
/** * Remove a key/value pair from this scope * @param prefix key to remove from the scope *///from w w w. j a v a2 s .c o m public void unassign(String prefix) { Set<String> removed = values.keySet().stream().filter(s -> s.startsWith(prefix)).collect(toSet()); removed.forEach(values::remove); }
From source file:com.livingobjects.wisdom.swagger.SwaggerDocController.java
/** * Notified when a given bundle is unloaded. Clear the corresponding uris stored in the maps. * * @param bundle The unloaded bundle.//from www . ja va 2 s .c o m */ void onBundleDeparture(Bundle bundle) { String name = bundle.getSymbolicName(); Set<String> baseUris = bundleBaseUris.get(name); if (baseUris != null) { baseUris.forEach(baseUriMap::remove); bundleBaseUris.remove(name); } }
From source file:nu.yona.server.subscriptions.service.NewDeviceRequestService.java
@Transactional public int deleteAllExpiredRequests() { Set<User> users = userRepository .findAllWithExpiredNewDeviceRequests(TimeUtil.utcNow().minus(getExpirationTime())); users.forEach(u -> removeNewDeviceRequest(u.getId(), "New device request for user with mobile number '{}' and ID '{}' was cleared because it was expired")); return users.size(); }
From source file:org.wso2.siddhi.extension.input.transport.http.Util.ServerUtil.java
public static List<HTTPServerConnector> startConnectors(TransportsConfiguration transportsConfiguration, CarbonMessageProcessor carbonMessageProcessor) { List<HTTPServerConnector> connectors = new ArrayList<>(); ServerConnectorController serverConnectorController = new ServerConnectorController( transportsConfiguration);// w w w . j av a2 s .c om Set<ListenerConfiguration> listenerConfigurationSet = transportsConfiguration.getListenerConfigurations(); HTTPClientConnector httpClientConnector = new HTTPClientConnector( transportsConfiguration.getSenderConfigurations(), transportsConfiguration.getTransportProperties()); HTTPTransportContextHolder.getInstance().setMessageProcessor(carbonMessageProcessor); carbonMessageProcessor.setClientConnector(httpClientConnector); Thread transportRunner = new Thread(() -> { try { serverConnectorController.start(); } catch (Exception e) { log.error("Unable to start Server Connector Controller ", e); } }); transportRunner.start(); try { Thread.sleep(ServerUtil.SERVERS_SETUP_TIME); } catch (InterruptedException e) { log.error("Thread Interrupted while sleeping ", e); } listenerConfigurationSet.forEach(config -> { HTTPServerConnector connector = new HTTPServerConnector(config.getId()); connector.setListenerConfiguration(config); connector.setServerConnectorController(serverConnectorController); serverConnectorController.bindInterface(connector); connector.setMessageProcessor(carbonMessageProcessor); connectors.add(connector); }); return connectors; }
From source file:com.hortonworks.streamline.registries.dashboard.service.DashboardCatalogService.java
public void removeWidgetDatasourceMapping(Widget widget, Set<Long> datasourceIds) { datasourceIds.forEach(datasourceId -> { dao.<WidgetDatasourceMapping>remove( new WidgetDatasourceMapping(widget.getId(), datasourceId).getStorableKey()); });/*from ww w.ja v a 2s . c o m*/ }