本文整理了Java中java.util.LinkedHashSet.forEach()
方法的一些代码示例,展示了LinkedHashSet.forEach()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedHashSet.forEach()
方法的具体详情如下:
包路径:java.util.LinkedHashSet
类名称:LinkedHashSet
方法名:forEach
暂无
代码示例来源:origin: benas/random-beans
private LinkedHashSet<RandomizerRegistry> setupRandomizerRegistries() {
LinkedHashSet<RandomizerRegistry> registries = new LinkedHashSet<>();
registries.add(customRandomizerRegistry);
registries.add(exclusionRandomizerRegistry);
registries.addAll(userRegistries);
registries.addAll(loadRegistries());
registries.forEach(registry -> registry.init(parameters));
return registries;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private static void addSortedBundle(Bundle bundle, Map<String, Bundle> bundles, LinkedHashSet<Bundle> sortedBundles,
LinkedHashSet<String> dependencyStack) {
String name = bundle.plugin.getName();
if (dependencyStack.contains(name)) {
StringBuilder msg = new StringBuilder("Cycle found in plugin dependencies: ");
dependencyStack.forEach(s -> {
msg.append(s);
msg.append(" -> ");
});
msg.append(name);
throw new IllegalStateException(msg.toString());
}
if (sortedBundles.contains(bundle)) {
// already added this plugin, via a dependency
return;
}
dependencyStack.add(name);
for (String dependency : bundle.plugin.getExtendedPlugins()) {
Bundle depBundle = bundles.get(dependency);
if (depBundle == null) {
throw new IllegalArgumentException("Missing plugin [" + dependency + "], dependency of [" + name + "]");
}
addSortedBundle(depBundle, bundles, sortedBundles, dependencyStack);
assert sortedBundles.contains(depBundle);
}
dependencyStack.remove(name);
sortedBundles.add(bundle);
}
代码示例来源:origin: ahmetaa/zemberek-nlp
provinces.forEach(pw::println);
pw.println("## --------- Cities --------");
cities.forEach(pw::println);
pw.println("## --------- Districts --------");
districts.forEach(pw::println);
pw.println("## --------- Villages --------");
villages.forEach(pw::println);
代码示例来源:origin: ahmetaa/zemberek-nlp
private static void removeZemberekDictionaryWordsFromList(Path input, Path out)
throws IOException {
LinkedHashSet<String> list = new LinkedHashSet<>(
Files.readAllLines(input, StandardCharsets.UTF_8));
System.out.println("Total amount of lines = " + list.size());
TurkishMorphology morphology = TurkishMorphology.create(
RootLexicon.builder().addTextDictionaryResources(
"tr/master-dictionary.dict",
"tr/non-tdk.dict",
"tr/proper.dict",
"tr/proper-from-corpus.dict",
"tr/abbreviations.dict"
).build());
List<String> toRemove = new ArrayList<>();
for (DictionaryItem item : morphology.getLexicon()) {
if (list.contains(item.lemma)) {
toRemove.add(item.lemma);
}
}
System.out.println("Total amount to remove = " + toRemove.size());
list.removeAll(toRemove);
try (PrintWriter pw = new PrintWriter(out.toFile(), "utf-8")) {
list.forEach(pw::println);
}
}
代码示例来源:origin: org.fcrepo/modeshape-jcr
protected void executeFunctionsUponCommit() {
try {
uponCommitFunctions.forEach(TransactionFunction::execute);
} finally {
uponCommitFunctions.clear();
}
}
}
代码示例来源:origin: perfectsense/brightspot-cms
@Override
protected void run() throws Exception {
// copy keys to new set to prevent concurrent modification exception.
new LinkedHashSet<>(ViewMap.this.unresolved.keySet()).forEach(ViewMap.this::get);
}
};
代码示例来源:origin: net.anwiba.commons/anwiba-commons-utilities
public PrefixToSystemPropertySubstituter(final List<String> propertyNames) {
new LinkedHashSet<>(propertyNames).forEach(property -> this.converters.add(string -> {
final String value = System.getProperty(property);
if (StringUtilities.isNullOrTrimmedEmpty(value) || !string.startsWith(value)) {
return string;
}
return "$SYSTEM{" + property + "}" + string.substring(value.length(), string.length()); //$NON-NLS-1$ //$NON-NLS-2$
}));
}
代码示例来源:origin: net.anwiba.commons/anwiba-commons-utilities
public StringToSystemPropertiesSubstituter(final List<String> propertyNames) {
new LinkedHashSet<>(propertyNames).forEach(property -> this.converters.add(string -> {
final String value = System.getProperty(property);
if (StringUtilities.isNullOrTrimmedEmpty(value) || !string.startsWith(value)) {
return string;
}
return "$SYSTEM{" + property + "}" + string.substring(value.length(), string.length()); //$NON-NLS-1$ //$NON-NLS-2$
}));
}
代码示例来源:origin: net.anwiba.commons/anwiba-commons-core
public PrefixToSystemPropertySubstituter(final List<String> propertyNames) {
new LinkedHashSet<>(propertyNames).forEach(property -> this.converters.add(string -> {
final String value = System.getProperty(property);
if (StringUtilities.isNullOrTrimmedEmpty(value) || !string.startsWith(value)) {
return string;
}
return "$SYSTEM{" + property + "}" + string.substring(value.length(), string.length()); //$NON-NLS-1$ //$NON-NLS-2$
}));
}
代码示例来源:origin: net.anwiba.commons/anwiba-commons-core
public StringToSystemPropertiesSubstituter(final List<String> propertyNames) {
new LinkedHashSet<>(propertyNames).forEach(property -> this.converters.add(string -> {
final String value = System.getProperty(property);
if (StringUtilities.isNullOrTrimmedEmpty(value) || !string.startsWith(value)) {
return string;
}
return "$SYSTEM{" + property + "}" + string.substring(value.length(), string.length()); //$NON-NLS-1$ //$NON-NLS-2$
}));
}
代码示例来源:origin: com.qwazr/qwazr-database
protected GroupQuery(TableQuery.Group groupQuery, QueryHook queryHook) throws QueryException {
queries = new ArrayList<>(groupQuery.queries.size());
groupQuery.queries.forEach(n -> this.queries.add(Query.prepare(n, queryHook)));
}
代码示例来源:origin: opencb/opencga
protected LinkedHashSet<String> getSampleNamesInFile(Integer fileId) {
LinkedHashSet<String> samples = new LinkedHashSet<>();
getSamplesInFile(fileId).forEach(sampleId -> {
samples.add(studyConfiguration.getSampleIds().inverse().get(sampleId));
});
return samples;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static PathBlock deduplicate(PathBlock pattern) {
PathBlock result = new PathBlock();
new LinkedHashSet<>(pattern.getList()).forEach(result::add);
return result;
}
代码示例来源:origin: com.netflix.governator/governator-core
@Override
protected void configure() {
bind(GovernatorFeatureSet.class).toInstance(featureSet);
bind(LifecycleManager.class).toInstance(manager);
Multibinder<String> profilesBinder = Multibinder.newSetBinder(binder(), Key.get(String.class, Profiles.class)).permitDuplicates();
profiles.forEach(profile -> profilesBinder.addBinding().toInstance(profile));
bind(String[].class).annotatedWith(Arguments.class).toInstance(args);
requestInjection(LifecycleInjectorCreator.this);
}
},
代码示例来源:origin: org.junit/junit-engine-api
@Override
public void accept(Visitor visitor) {
Runnable remove = this::removeFromHierarchy;
visitor.visit(this, remove);
new LinkedHashSet<>(getChildren()).forEach(child -> child.accept(visitor));
}
代码示例来源:origin: org.junit.platform/junit-platform-engine
/**
* Accept a {@link Visitor} to the subtree starting with this descriptor.
*
* @param visitor the {@code Visitor} to accept; never {@code null}
*/
default void accept(Visitor visitor) {
Preconditions.notNull(visitor, "Visitor must not be null");
visitor.visit(this);
// Create a copy of the set in order to avoid a ConcurrentModificationException
new LinkedHashSet<>(this.getChildren()).forEach(child -> child.accept(visitor));
}
代码示例来源:origin: owlcs/owlapi
private void renderSWRLRules() {
List<SWRLRule> ruleAxioms = asList(ontology.axioms(SWRL_RULE).sorted());
createGraph(ruleAxioms.stream());
if (!ruleAxioms.isEmpty()) {
writeBanner(RULES_BANNER_TEXT);
SWRLVariableExtractor variableExtractor = new SWRLVariableExtractor();
ruleAxioms.forEach(rule -> rule.accept(variableExtractor));
variableExtractor.getVariables()
.forEach(var -> render(new RDFResourceIRI(var.getIRI()), true));
renderAnonRoots();
}
}
代码示例来源:origin: net.sourceforge.owlapi/owlapi-distribution
private void renderSWRLRules() {
List<SWRLRule> ruleAxioms = asList(ontology.axioms(SWRL_RULE).sorted());
createGraph(ruleAxioms.stream());
if (!ruleAxioms.isEmpty()) {
writeBanner(RULES_BANNER_TEXT);
SWRLVariableExtractor variableExtractor = new SWRLVariableExtractor();
ruleAxioms.forEach(rule -> rule.accept(variableExtractor));
variableExtractor.getVariables()
.forEach(var -> render(new RDFResourceIRI(var.getIRI()), true));
renderAnonRoots();
}
}
代码示例来源:origin: net.sourceforge.owlapi/owlapi-osgidistribution
private void renderSWRLRules() {
List<SWRLRule> ruleAxioms = asList(ontology.axioms(SWRL_RULE).sorted());
createGraph(ruleAxioms.stream());
if (!ruleAxioms.isEmpty()) {
writeBanner(RULES_BANNER_TEXT);
SWRLVariableExtractor variableExtractor = new SWRLVariableExtractor();
ruleAxioms.forEach(rule -> rule.accept(variableExtractor));
variableExtractor.getVariables()
.forEach(var -> render(new RDFResourceIRI(var.getIRI()), true));
renderAnonRoots();
}
}
代码示例来源:origin: opencb/opencga
public void checkSampleData(Variant variant, StudyConfiguration studyConfiguration, Integer fileId, Function<Integer, String>
valueProvider, String field) {
assertTrue(studyConfiguration.getFileIds().values().contains(fileId));
studyConfiguration.getSamplesInFiles().get(fileId).forEach((sampleId) ->
{
String sampleName = studyConfiguration.getSampleIds().inverse().get(sampleId);
StudyEntry study = variant.getStudy(studyConfiguration.getStudyName());
assertTrue(study.getSamplesName().contains(sampleName));
assertEquals("Variant=" + variant + " StudyId=" + studyConfiguration.getStudyId() + " FileId=" + fileId + " Field=" + field + " Sample=" + sampleName + " (" + sampleId + ")\n"+variant.toJson(),
valueProvider.apply(sampleId), study.getSampleData(sampleName, field));
});
}
内容来源于网络,如有侵权,请联系作者删除!