本文整理了Java中java.util.LinkedHashSet.stream()
方法的一些代码示例,展示了LinkedHashSet.stream()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedHashSet.stream()
方法的具体详情如下:
包路径:java.util.LinkedHashSet
类名称:LinkedHashSet
方法名:stream
暂无
代码示例来源:origin: prestodb/presto
@VisibleForTesting
JoinEnumerationResult createJoinAccordingToPartitioning(LinkedHashSet<PlanNode> sources, List<Symbol> outputSymbols, Set<Integer> partitioning)
{
List<PlanNode> sourceList = ImmutableList.copyOf(sources);
LinkedHashSet<PlanNode> leftSources = partitioning.stream()
.map(sourceList::get)
.collect(toCollection(LinkedHashSet::new));
LinkedHashSet<PlanNode> rightSources = sources.stream()
.filter(source -> !leftSources.contains(source))
.collect(toCollection(LinkedHashSet::new));
return createJoin(leftSources, rightSources, outputSymbols);
}
代码示例来源:origin: prestodb/presto
public MultiJoinNode(LinkedHashSet<PlanNode> sources, Expression filter, List<Symbol> outputSymbols)
{
requireNonNull(sources, "sources is null");
checkArgument(sources.size() > 1, "sources size is <= 1");
requireNonNull(filter, "filter is null");
requireNonNull(outputSymbols, "outputSymbols is null");
this.sources = sources;
this.filter = filter;
this.outputSymbols = ImmutableList.copyOf(outputSymbols);
List<Symbol> inputSymbols = sources.stream().flatMap(source -> source.getOutputSymbols().stream()).collect(toImmutableList());
checkArgument(inputSymbols.containsAll(outputSymbols), "inputs do not contain all output symbols");
}
代码示例来源:origin: google/guava
public void testMapWithIndex_linkedHashSetSource() {
testMapWithIndex(elems -> new LinkedHashSet<>(elems).stream());
}
代码示例来源:origin: google/error-prone
private static Optional<Fix> fix(Tree target, Tree replace, VisitorState state) {
return Optional.fromJavaUtil(
FindIdentifiers.findAllIdents(state).stream()
.filter(
s ->
isSubtype(
s.type,
state.getTypeFromString("com.google.errorprone.VisitorState"),
state))
.findFirst()
.map(
s ->
SuggestedFix.replace(
replace,
String.format(
"%s.getSourceForNode(%s)", s, state.getSourceForNode(target)))));
}
}
代码示例来源:origin: prestodb/presto
private JoinEnumerationResult createJoin(LinkedHashSet<PlanNode> leftSources, LinkedHashSet<PlanNode> rightSources, List<Symbol> outputSymbols)
Set<Symbol> leftSymbols = leftSources.stream()
.flatMap(node -> node.getOutputSymbols().stream())
.collect(toImmutableSet());
Set<Symbol> rightSymbols = rightSources.stream()
.flatMap(node -> node.getOutputSymbols().stream())
.collect(toImmutableSet());
代码示例来源:origin: spring-cloud/spring-cloud-gateway
originalUris.stream().forEach(originalUri -> {
代码示例来源:origin: cincheo/jsweet
private static <T> void dumpCycles(List<Node<T>> nodes, Stack<Node<T>> path, Function<T, String> toString) {
path.peek().outEdges.stream().map(e -> e.to).forEach(node -> {
if (nodes.contains(node)) {
if (path.contains(node)) {
System.out.println(
"cycle: " + path.stream().map(n -> toString.apply(n.element)).collect(Collectors.toList()));
} else {
path.push(node);
dumpCycles(nodes, path, toString);
path.pop();
}
}
});
;
}
代码示例来源:origin: ahmetaa/zemberek-nlp
public List<String> getSentences(
String word,
int sentenceCount,
int minTokenCount,
int maxTokenCount) throws Exception {
// load and eliminate duplicates.
LinkedHashSet<String> sentences = new LinkedHashSet<>(searcher.search(word, 1000));
// filter and sort from smaller to larger sentences.
List<String> filtered = sentences.stream()
.filter(s -> {
int k = s.split(" ").length;
return k >= minTokenCount && k <= maxTokenCount;
})
.filter(s -> !s.contains("\""))
.filter(s -> !s.contains(")"))
.filter(s -> !s.contains("-"))
//.sorted(Comparator.comparingInt(a -> a.split(" ").length))
.collect(Collectors.toList());
Collections.shuffle(filtered);
int max = filtered.size() < sentenceCount ? filtered.size() : sentenceCount;
return new ArrayList<>(filtered.subList(0, max));
}
代码示例来源:origin: ahmetaa/zemberek-nlp
all.stream().sorted(Turkish.STRING_COMPARATOR_ASC).forEach(pw::println);
代码示例来源:origin: ahmetaa/zemberek-nlp
candidates.stream().map(Candidate::new).collect(Collectors.toList()));
代码示例来源:origin: net.sourceforge.owlapi/jfact
/**
* @param upDirection
* upDirection
* @return Links
*/
@PortedFrom(file = "taxVertex.h", name = "neigh")
public Stream<TaxonomyVertex> neigh(boolean upDirection) {
return upDirection ? linksParent.stream() : linksChild.stream();
}
代码示例来源:origin: jsevellec/cassandra-unit
void deleteFilesForRecordsOfType(Type type)
{
records.stream()
.filter(type::matches)
.forEach(LogFile::deleteRecordFiles);
records.clear();
}
代码示例来源:origin: org.apache.cassandra/cassandra-all
void deleteFilesForRecordsOfType(Type type)
{
records.stream()
.filter(type::matches)
.forEach(LogFile::deleteRecordFiles);
records.clear();
}
代码示例来源:origin: com.oracle.substratevm/svm-driver
private static void writeServerFile(Path serverDir, int port, long pid, LinkedHashSet<Path> classpath, LinkedHashSet<Path> bootClasspath, List<String> javaArgs) throws Exception {
Properties sp = new Properties();
sp.setProperty(Server.pKeyPort, String.valueOf(port));
sp.setProperty(Server.pKeyPID, String.valueOf(pid));
sp.setProperty(Server.pKeyJavaArgs, String.join(" ", javaArgs));
sp.setProperty(Server.pKeyBCP, bootClasspath.stream().map(ImageClassLoader::classpathToString).collect(Collectors.joining(" ")));
sp.setProperty(Server.pKeyCP, classpath.stream().map(ImageClassLoader::classpathToString).collect(Collectors.joining(" ")));
Path serverPropertiesPath = serverDir.resolve(Server.serverProperties);
try (OutputStream os = Files.newOutputStream(serverPropertiesPath)) {
sp.store(os, "");
}
}
代码示例来源:origin: org.ballerinalang/ballerina-lang
private boolean checkUnionTypeToJSONConvertibility(BUnionType type, BJSONType target) {
// Check whether all the member types are convertible to JSON
return type.memberTypes.stream()
.anyMatch(memberType -> castVisitor.visit(memberType, target) == symTable.notFoundSymbol);
}
代码示例来源:origin: spring-projects/spring-data-jdbc
private String createInsertSql(Set<String> additionalColumns) {
String insertTemplate = "INSERT INTO %s (%s) VALUES (%s)";
LinkedHashSet<String> columnNamesForInsert = new LinkedHashSet<>(nonIdColumnNames);
columnNamesForInsert.addAll(additionalColumns);
String tableColumns = String.join(", ", columnNamesForInsert);
String parameterNames = columnNamesForInsert.stream()//
.map(n -> String.format(":%s", n))//
.collect(Collectors.joining(", "));
return String.format(insertTemplate, entity.getTableName(), tableColumns, parameterNames);
}
代码示例来源:origin: cn.home1/oss-lib-common-spring-boot-1.4.2.RELEASE
static Optional<String> findEnv(final Environment environment) {
final Collection<String> activeProfiles = asList(environment.getActiveProfiles());
final Collection<String> envProfiles = newLinkedHashSet(activeProfiles).stream() //
.filter(profile -> profile.endsWith(DOT_ENV)) //
.map(profile -> profile.substring(0, profile.length() - 4)).collect(toList());
checkArgument(envProfiles.size() < 2, "only 1 env is allowed, there are %s", envProfiles);
return Optional.ofNullable(!envProfiles.isEmpty() ? envProfiles.iterator().next() : null);
}
代码示例来源:origin: org.ballerinalang/ballerina-lang
private boolean isSafeNavigationAllowedBuiltinInvocation(BLangInvocation iExpr) {
if (iExpr.builtInMethod == BLangBuiltInMethod.FREEZE) {
if (iExpr.expr.type.tag == TypeTags.UNION && iExpr.expr.type.isNullable()) {
BUnionType unionType = (BUnionType) iExpr.expr.type;
return unionType.memberTypes.size() == 2 && unionType.memberTypes.stream()
.noneMatch(type -> type.tag != TypeTags.NIL && types.isValueType(type));
}
} else if (iExpr.builtInMethod == BLangBuiltInMethod.IS_FROZEN) {
return false;
}
return true;
}
代码示例来源:origin: yahoo/elide
public void saveOrCreateObjects() {
dirtyResources.removeAll(newPersistentResources);
// Delete has already been called on these objects
dirtyResources.removeAll(deletedResources);
newPersistentResources
.stream()
.map(PersistentResource::getObject)
.forEach(s -> transaction.createObject(s, this));
dirtyResources.stream().map(PersistentResource::getObject).forEach(obj -> transaction.save(obj, this));
}
代码示例来源:origin: io.scalecube/scalecube-cluster
private List<Address> cleanUpSeedMembers(Collection<Address> seedMembers) {
return new LinkedHashSet<>(seedMembers)
.stream()
.filter(address -> !address.equals(localMember.address()))
.filter(address -> !address.equals(transport.address()))
.collect(Collectors.toList());
}
内容来源于网络,如有侵权,请联系作者删除!