List of usage examples for java.util Collection forEach
default void forEach(Consumer<? super T> action)
From source file:org.apache.syncope.core.spring.security.SyncopeGrantedAuthority.java
public void addRealms(final Collection<String> newRealms) { newRealms.forEach(newRealm -> addRealm(newRealm)); }
From source file:de.bund.bfr.knime.gis.views.canvas.CanvasUtils.java
private static <E extends Element> HighlightResult<E> getResult(Collection<E> elements, HighlightConditionList highlightConditions) { List<Color> colorList = new ArrayList<>(); ListMultimap<E, Double> alphaValues = ArrayListMultimap.create(); Map<E, Double> thicknessValues = new LinkedHashMap<>(); SetMultimap<E, String> labelLists = LinkedHashMultimap.create(); Map<E, NamedShape> shapes = new LinkedHashMap<>(); elements.forEach(e -> thicknessValues.put(e, 0.0)); for (HighlightCondition condition : highlightConditions.getConditions()) { if (condition.isInvisible()) { continue; }/*from w w w.j a v a2 s. com*/ Map<E, Double> values = condition.getValues(elements); if (condition.getColor() != null) { colorList.add(condition.getColor()); for (E e : elements) { List<Double> alphas = alphaValues.get(e); if (!highlightConditions.isPrioritizeColors() || alphas.isEmpty() || Collections.max(alphas) == 0.0) { alphas.add(values.get(e)); } else { alphas.add(0.0); } } } if (condition.isUseThickness()) { elements.forEach(e -> thicknessValues.put(e, thicknessValues.get(e) + values.get(e))); } if (condition.getLabelProperty() != null) { String property = condition.getLabelProperty(); for (E e : elements) { if (values.get(e) != 0.0 && e.getProperties().get(property) != null) { labelLists.put(e, toString(e.getProperties().get(property))); } } } if (condition.getShape() != null) { for (E e : elements) { if (values.get(e) != 0.0 && !shapes.containsKey(e)) { shapes.put(e, condition.getShape()); } } } } Map<E, Paint> colors = new LinkedHashMap<>(); Map<E, String> labels = new LinkedHashMap<>(); Multimaps.asMap(alphaValues).forEach((e, alphas) -> colors.put(e, CanvasUtils .mixColors(e instanceof Edge ? Color.BLACK : Color.WHITE, colorList, alphas, e instanceof Edge))); Multimaps.asMap(labelLists).forEach((e, labelList) -> labels.put(e, Joiner.on("/").join(labelList))); HighlightResult<E> result = new HighlightResult<>(); result.colors = colors; result.thicknessValues = thicknessValues; result.labels = labels; result.shapes = shapes; return result; }
From source file:cn.edu.zjnu.acm.judge.mapper.LanguageMapperTest.java
@Ignore @Test/* ww w . j av a2s . co m*/ @Transactional public void test() { log.debug("delete"); Collection<Language> languages = languageService.getAvailableLanguages().values(); languages.forEach(instance::delete); log.debug("save"); languages.forEach(instance::save); }
From source file:de.acosix.alfresco.utility.repo.subsystems.SubsystemChildApplicationContextManagerTest.java
@Test public void simplyStartAll() { try (final ClassPathXmlApplicationContext ctxt = new ClassPathXmlApplicationContext( "classpath:subsystem-manager-test-context.xml")) { final SubsystemChildApplicationContextManager manager = ctxt.getBean("SubsystemManagerTest", SubsystemChildApplicationContextManager.class); Assert.assertNotNull("manager bean was not found", manager); final Collection<String> instanceIds = manager.getInstanceIds(); instanceIds.forEach(id -> { final ApplicationContext childCtxt = manager.getApplicationContext(id); Assert.assertNotNull("subsystem " + id + " was not started", childCtxt); });//from w w w.java 2s . c o m } }
From source file:org.springframework.boot.actuate.endpoint.jmx.JmxEndpointExporter.java
private void unregister(Collection<ObjectName> objectNames) { objectNames.forEach(this::unregister); }
From source file:com.hurence.logisland.processor.excel.ExcelExtractTest.java
private void assertRecordValid(Collection<MockRecord> records) { records.forEach(record -> { record.assertFieldExists("Product"); record.assertFieldExists("Date"); record.assertFieldTypeEquals("Product", FieldType.STRING); record.assertFieldTypeEquals("Date", FieldType.LONG); record.assertFieldExists(Fields.SHEET_NAME); record.assertFieldExists(Fields.ROW_NUMBER); });/*from w w w . j av a 2 s. c o m*/ }
From source file:org.sejda.model.parameter.RotateParameters.java
public void addAllPageRanges(Collection<PageRange> ranges) { ranges.forEach(this::addPageRange); }
From source file:org.mule.runtime.extension.api.model.AbstractImmutableModel.java
private void loadProperties(Collection<ModelProperty> properties) { if (properties != null) { properties.forEach(property -> modelProperties.put(property.getClass(), property)); }//from ww w. j a v a 2s. co m }
From source file:edu.umd.umiacs.clip.tools.scor.PSQW2VBM25Scorer.java
private Map<String, Float> getWeightedTerm(String term) { Map<String, Float> map = new HashMap<>(); int df = df(term); map.put(term, 1f);/*from ww w. j a va2s. c o m*/ if (df > 1) { Collection<String> words = getWord2Vec().wordsNearest(term, nearestTerms); words.forEach(word -> map.put(word, (float) getWord2Vec().similarity(term, word))); float sum = (float) map.values().parallelStream().mapToDouble(d -> d).sum(); map.keySet().forEach(key -> map.put(key, map.get(key) / sum)); } return map; }
From source file:org.nuxeo.ecm.blob.azure.AzureBinaryManager.java
@Override public void removeBinaries(Collection<String> digests) { digests.forEach(this::removeBinary); }