List of usage examples for java.util Collection forEach
default void forEach(Consumer<? super T> action)
From source file:de.bund.bfr.knime.pmmlite.core.PmmUtils.java
public static <V extends Nameable> Map<String, V> getByName(Collection<V> nameables) { Map<String, V> byName = new LinkedHashMap<>(); nameables.forEach(n -> byName.put(n.getName(), n)); return byName; }
From source file:de.bund.bfr.knime.pmmlite.core.PmmUtils.java
public static <V extends Identifiable> Map<String, V> getById(Collection<V> identifiables) { Map<String, V> byId = new LinkedHashMap<>(); identifiables.forEach(i -> byId.put(i.getId(), i)); return byId;/*w w w .j a v a 2s . co m*/ }
From source file:de.bund.bfr.knime.pmmlite.core.PmmUtils.java
public static Map<String, Double> getMinValues(Collection<Parameter> parameters) { Map<String, Double> minValues = new LinkedHashMap<>(); parameters.forEach(p -> minValues.put(p.getName(), p.getMin())); return minValues; }
From source file:de.bund.bfr.knime.pmmlite.core.PmmUtils.java
public static Map<String, Double> getMaxValues(Collection<Parameter> parameters) { Map<String, Double> maxValues = new LinkedHashMap<>(); parameters.forEach(p -> maxValues.put(p.getName(), p.getMax())); return maxValues; }
From source file:org.jboss.as.clustering.infinispan.subsystem.HealthMetricsHandler.java
private static Collection<ModelNode> toModelNodeCollection(Collection<String> collection) { if (collection == null || collection.isEmpty()) { return Collections.emptyList(); }// w w w . j a v a 2 s . c o m Collection<ModelNode> modelNodeCollection = new ArrayList<>(collection.size()); collection.forEach(e -> modelNodeCollection.add(new ModelNode().set(e))); return modelNodeCollection; }
From source file:org.apdplat.superword.tools.TextAnalyzer.java
/** * @param files ?/*from www . j av a2 s.c o m*/ * @return ?? */ public static Map<String, AtomicInteger> frequency(Collection<String> files) { Map<String, AtomicInteger> map = new ConcurrentHashMap<>(); files.forEach(file -> { LOGGER.info("parse text file: " + file); //? Map<String, AtomicInteger> data = frequency(file); //? data.entrySet().forEach(entry -> { map.putIfAbsent(entry.getKey(), new AtomicInteger()); map.get(entry.getKey()).addAndGet(entry.getValue().get()); }); data.clear(); }); LOGGER.info("total unique words count: " + map.size()); return map; }
From source file:spoon.IncrementalLauncher.java
private static Set<File> getAllJavaFiles(Set<File> resources) { Set<File> javaFiles = new HashSet<>(); for (File e : resources) { if (e.isDirectory()) { Collection<File> files = FileUtils.listFiles(e, new SuffixFileFilter(".java"), TrueFileFilter.INSTANCE); files.forEach(f -> { try { javaFiles.add(f.getCanonicalFile()); } catch (IOException e1) { throw new SpoonException("unable to locate input source file: " + f); }/*www . j a v a 2 s . c o m*/ }); } else if (e.isFile() && e.getName().endsWith(".java")) { try { javaFiles.add(e.getCanonicalFile()); } catch (IOException e1) { throw new SpoonException("unable to locate input source file: " + e); } } } return javaFiles; }
From source file:org.sonar.java.se.MethodYield.java
private static Set<ProgramState> programStatesForConstraint(Collection<ProgramState> states, SymbolicValue invokedArg, Constraint constraint) { Set<ProgramState> programStates = new LinkedHashSet<>(); if (constraint instanceof ObjectConstraint) { ObjectConstraint objectConstraint = (ObjectConstraint) constraint; states.forEach(state -> programStates.addAll(invokedArg.setConstraint(state, objectConstraint))); } else if (constraint instanceof BooleanConstraint) { BooleanConstraint booleanConstraint = (BooleanConstraint) constraint; states.forEach(state -> programStates.addAll(invokedArg.setConstraint(state, booleanConstraint))); }//from w w w . ja va2s. c om return programStates; }
From source file:com.scaniatv.LangFileUpdater.java
/** * Method that gets a list of all lang files. * //from w w w . j a va 2s. c o m * @return */ public static String[] getLangFiles() { Collection<File> files = FileUtils.listFiles(new File(DEFAULT_LANG_ROOT), TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); ArrayList<String> fileNames = new ArrayList<>(); String sep = File.separator; files.forEach((File file) -> { fileNames.add(file.getPath().replace("." + sep + "scripts" + sep + "lang" + sep + "english" + sep, "")); }); return fileNames.toArray(new String[fileNames.size()]); }
From source file:org.mitre.mpf.wfm.service.component.StartupComponentRegistrationServiceImpl.java
private static void logDescriptorsWithNoMatchingPackages(Collection<Path> allDeployedDescriptors, Collection<Path> mappedDescriptors) { Collection<Path> descriptorsWithNoMatchingPackages = new HashSet<>(allDeployedDescriptors); descriptorsWithNoMatchingPackages.removeAll(mappedDescriptors); if (descriptorsWithNoMatchingPackages.isEmpty()) { return;/*from w ww. j a v a 2s . c o m*/ } _log.error( "The following descriptors do not have a matching component package and can not be registered: "); descriptorsWithNoMatchingPackages.forEach(d -> _log.error(d.toString())); }